Class: Gem::Commands::GrepCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::GrepCommand
- Defined in:
- lib/rubygems/commands/grep_command.rb
Defined Under Namespace
Classes: CapturedUI
Instance Method Summary collapse
- #description ⇒ Object
- #execute ⇒ Object
- #grep_command(path_args, grep_args) ⇒ Object
-
#initialize ⇒ GrepCommand
constructor
A new instance of GrepCommand.
Constructor Details
#initialize ⇒ GrepCommand
Returns a new instance of GrepCommand.
15 16 17 |
# File 'lib/rubygems/commands/grep_command.rb', line 15 def initialize super('grep', description) end |
Instance Method Details
#description ⇒ Object
11 12 13 |
# File 'lib/rubygems/commands/grep_command.rb', line 11 def description 'Grep the gem for a given name or grep the file for a given require path' end |
#execute ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/rubygems/commands/grep_command.rb', line 19 def execute if [:build_args].empty? alert_error('No pattern specified') terminate_interaction(1) end exec(*grep_command([:args], [:build_args])) end |
#grep_command(path_args, grep_args) ⇒ Object
28 29 30 |
# File 'lib/rubygems/commands/grep_command.rb', line 28 def grep_command path_args, grep_args [grep_name, *grep_args, *grep_default_args, capture_path(*path_args)] end |