List all gemsets for the given ruby.

    ruby : default
        The ruby version for which to list the gemsets

    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

def gemset_list(ruby='default', runas=None):
    '''
    List all gemsets for the given ruby.

    ruby : default
        The ruby version for which to list the gemsets

    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
    '''
    gemsets = []
    output = _rvm_do(ruby, ['rvm', 'gemset', 'list'], runas=runas)
    if output:
        regex = re.compile('^   ([^ ]+)')
        for line in output.splitlines():
            match = regex.match(line)
            if match:
                gemsets.append(match.group(1))
    return gemsets