List all gemsets for all installed rubies.

    Note that you must have set a default ruby before this can work.

    runas
        The user under which to run rvm. If not specified, then rvm will be run
        as the user under which Salt is running.

    CLI Example:

    .. code-block:: bash

        salt '*' rvm.gemset_list_all

def gemset_list_all(runas=None):
    '''
    List all gemsets for all installed rubies.

    Note that you must have set a default ruby before this can work.

    runas
        The user under which to run rvm. If not specified, then rvm will be run
        as the user under which Salt is running.

    CLI Example:

    .. code-block:: bash

        salt '*' rvm.gemset_list_all
    '''
    gemsets = {}
    current_ruby = None
    output = _rvm_do('default', ['rvm', 'gemset', 'list_all'], runas=runas)
    if output:
        gems_regex = re.compile('^   ([^ ]+)')
        gemset_regex = re.compile('^gemsets for ([^ ]+)')
        for line in output.splitlines():
            match = gemset_regex.match(line)
            if match:
                current_ruby = match.group(1)
                gemsets[current_ruby] = []
            match = gems_regex.match(line)
            if match:
                gemsets[current_ruby].append(match.group(1))
    return gemsets