Class: GemInstaller::ExactMatchListCommand

Inherits:
LIST_COMMAND_CLASS
  • Object
show all
Defined in:
lib/geminstaller/exact_match_list_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/geminstaller/exact_match_list_command.rb', line 3

def execute
  string = get_one_optional_argument || ''
  # This overrides the default RubyGems ListCommand behavior of doing a wildcard match.  This caused problems
  # when some gems (ActiveRecord-JDBC) caused exceptions during a remote list, causing a remote list
  # of other gems (activerecord) to fail as well
  options[:name] = /^#{string}$/i
  # Do a little metaprogramming magic to avoid calling the problematic execute method on the ListCommand
  # superclass, and instead directly call the method on the QueryCommand grandparent 'supersuperclass'
  unbound_execute_method = QUERY_COMMAND_CLASS.instance_method(:execute)
  bound_execute_method = unbound_execute_method.bind(self)
  bound_execute_method.call
end