Class: Brigit::Command
- Inherits:
-
Object
- Object
- Brigit::Command
- Includes:
- Fallible, Listable, Pretending
- Defined in:
- lib/brigit/commands/command.rb
Direct Known Subclasses
GrabCommand, HopCommand, MapCommand, StatusCommand, UpdateCommand
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Command
constructor
A new instance of Command.
- #run {|parser| ... } ⇒ Object
Methods included from Pretending
Methods included from Fallible
Methods included from Listable
Constructor Details
#initialize(*args) ⇒ Command
Returns a new instance of Command.
25 26 27 |
# File 'lib/brigit/commands/command.rb', line 25 def initialize(*args) @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
24 25 26 |
# File 'lib/brigit/commands/command.rb', line 24 def args @args end |
Class Method Details
.help ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/brigit/commands/command.rb', line 13 def self.help @help ||= begin help_file = File.dirname(__FILE__) << "/../../../help/#{name}.rdoc" if File.file?(help_file) File.read(help_file) else "Sorry, there is no documentation for this command." end end end |
Instance Method Details
#run {|parser| ... } ⇒ Object
29 30 31 32 |
# File 'lib/brigit/commands/command.rb', line 29 def run yield parser if block_given? parser.parse!(args) end |