Class: Gem::Commands::CdCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::CdCommand
- Defined in:
- lib/rubygems/commands/cd.rb
Instance Method Summary collapse
- #arguments ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ CdCommand
constructor
A new instance of CdCommand.
Constructor Details
#initialize ⇒ CdCommand
Returns a new instance of CdCommand.
2 3 4 |
# File 'lib/rubygems/commands/cd.rb', line 2 def initialize super 'cd', "Navigates to the gem's source directory." end |
Instance Method Details
#arguments ⇒ Object
6 7 8 |
# File 'lib/rubygems/commands/cd.rb', line 6 def arguments "GEM gem to open" end |
#execute ⇒ Object
10 11 12 13 14 15 |
# File 'lib/rubygems/commands/cd.rb', line 10 def execute gem = [:args].first raise Gem::CommandLineError, 'Usage: gem cd GEM' unless gem Dir.chdir("#{Gem::Specification.find_by_name(gem).full_gem_path}") exec '$0' end |