@classmethod
    def lookup_executables(cls, cmd):
        """
        Attempt to locate the gem and ruby specified in cmd, return new cmd list.

        The following forms are valid:

        gem@ruby
        gem
        ruby

        If rbenv is installed and the gem is also under rbenv control,
        the gem will be executed directly. Otherwise [ruby <, gem>] will
        be returned.

        If rvm-auto-ruby is installed, [rvm-auto-ruby <, gem>] will be
        returned.

        Otherwise [ruby] or [gem] will be returned.

        """

        ruby = None
        rbenv = util.which('rbenv')

        if not rbenv:
            ruby = util.which('rvm-auto-ruby')

        if not ruby:
            ruby = util.which('ruby')

        if not rbenv and not ruby:
            persist.printf(
                'WARNING: {} deactivated, cannot locate ruby, rbenv or rvm-auto-ruby'
                .format(cls.name, cmd[0])
            )
            return []

        if isinstance(cmd, str):
            cmd = shlex.split(cmd)

        match = CMD_RE.match(cmd[0])

        if match:
            gem = match.group('gem')
        elif cmd[0] != 'ruby':
            gem = cmd[0]
        else:
            gem = ''

        if gem:
            gem_path = util.which(gem)

            if gem_path:
                if (rbenv and
                    ('{0}.rbenv{0}shims{0}'.format(os.sep) in gem_path or
                     (os.altsep and '{0}.rbenv{0}shims{0}'.format(gem_path in os.altsep)))):
                    ruby_cmd = [gem_path]
                elif (sublime.platform() == 'windows'):
                    ruby_cmd = [gem_path]
                else:
                    ruby_cmd = [ruby, gem_path]
            else:
                persist.printf(
                    'WARNING: {} deactivated, cannot locate the gem \'{}\''
                    .format(cls.name, gem)
                )
                return []
        else:
            ruby_cmd = [ruby]

        if cls.env is None:
            # Don't use GEM_HOME with rbenv, it prevents it from using gem shims
            if rbenv:
                cls.env = {}
            else:
                gem_home = util.get_environment_variable('GEM_HOME')

                if gem_home:
                    cls.env = {'GEM_HOME': gem_home}
                else:
                    cls.env = {}

        return ruby_cmd
dataset/ETHPy150Open SublimeLinter/SublimeLinter3/lint/ruby_linter.py/RubyLinter.lookup_executables/swapped operands of `in`