Class: Gem::SearchCommand

Inherits:
QueryCommand show all
Includes:
CommandAids
Defined in:
lib/rubygems/gem_commands.rb

Instance Attribute Summary

Attributes inherited from Command

#command, #defaults, #options, #program_name, #summary

Instance Method Summary collapse

Methods included from CommandAids

#begins?, #get_all_gem_names, #get_one_gem_name, #get_one_optional_argument

Methods included from LocalRemoteOptions

#add_local_remote_options, #local?, #remote?

Methods inherited from Command

add_common_option, #add_option, add_specific_extra_args, common_options, extra_args, extra_args=, #handles?, #invoke, #merge_options, #remove_option, #show_help, specific_extra_args, specific_extra_args_hash, #when_invoked

Methods included from DefaultUserInteraction

#ui, ui, #ui=, ui=, #use_ui, use_ui

Constructor Details

#initializeSearchCommand

Returns a new instance of SearchCommand.



894
895
896
897
898
899
900
# File 'lib/rubygems/gem_commands.rb', line 894

def initialize
  super(
    'search',
    'Display all gems whose name contains STRING'
  )
  remove_option('--name-matches')
end

Instance Method Details

#argumentsObject



910
911
912
# File 'lib/rubygems/gem_commands.rb', line 910

def arguments
  "STRING   fragment of gem name to look for"
end

#defaults_strObject



902
903
904
# File 'lib/rubygems/gem_commands.rb', line 902

def defaults_str
  "--local --no-details"
end

#executeObject



914
915
916
917
918
# File 'lib/rubygems/gem_commands.rb', line 914

def execute
  string = get_one_optional_argument
  options[:name] = /#{string}/i
  super
end

#usageObject



906
907
908
# File 'lib/rubygems/gem_commands.rb', line 906

def usage
  "#{program_name} [STRING]"
end