.. versionadded:: 2015.8.0

    Check if an upgrade is available for installed gems

    gem_bin : None
        Full path to ``gem`` binary to use.
    ruby : None
        If RVM or rbenv are installed, the ruby version and gemset to use.
        Ignored if ``gem_bin`` is specified.
    runas : None
        The user to run gem as.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.list_upgrades

def list_upgrades(ruby=None,
                  runas=None,
                  gem_bin=None):
    '''
    .. versionadded:: 2015.8.0

    Check if an upgrade is available for installed gems

    gem_bin : None
        Full path to ``gem`` binary to use.
    ruby : None
        If RVM or rbenv are installed, the ruby version and gemset to use.
        Ignored if ``gem_bin`` is specified.
    runas : None
        The user to run gem as.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.list_upgrades
    '''
    result = _gem(['outdated'],
                  ruby,
                  gem_bin=gem_bin,
                  runas=runas)
    ret = {}
    for line in salt.utils.itertools.split(result, '\n'):
        match = re.search(r'(\S+) \(\S+ < (\S+)\)', line)
        if match:
            name, version = match.groups()
        else:
            log.error('Can\'t parse line \'%s\'', line)
            continue
        ret[name] = version
    return ret