Flowdock
method

execute

Importance_0
Ruby latest stable (v2_5_5) - 0 notes - Class: QueryCommand
execute() public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rubygems/commands/query_command.rb, line 80
  def execute
    exit_code = 0
    if options[:args].to_a.empty? and options[:name].source.empty?
      name = options[:name]
      no_name = true
    elsif !options[:name].source.empty?
      name = Array(options[:name])
    else
      args = options[:args].to_a
      name = options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/ }
    end

    prerelease = options[:prerelease]

    unless options[:installed].nil? then
      if no_name then
        alert_error "You must specify a gem name"
        exit_code |= 4
      elsif name.count > 1
        alert_error "You must specify only ONE gem!"
        exit_code |= 4
      else
        installed = installed? name.first, options[:version]
        installed = !installed unless options[:installed]

        if installed then
          say "true"
        else
          say "false"
          exit_code |= 1
        end
      end

      terminate_interaction exit_code
    end

    names = Array(name)
    names.each { |n| show_gems n, prerelease }
  end
Register or log in to add new notes.