Class: Appli::Command
- Inherits:
-
Object
- Object
- Appli::Command
- Defined in:
- lib/appli/command.rb
Instance Method Summary collapse
- #call(options, *args) ⇒ Object
- #debug? ⇒ Boolean
-
#initialize(block) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(block) ⇒ Command
Returns a new instance of Command.
4 5 6 |
# File 'lib/appli/command.rb', line 4 def initialize(block) (class << self;self end).send :define_method, :command, &block end |
Instance Method Details
#call(options, *args) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/appli/command.rb', line 12 def call(, *args) @options = arity = method(:command).arity args << nil while args.size < arity send :command, *args rescue Error => e puts "An error occured while excuting your command...\n#{e.}" end |
#debug? ⇒ Boolean
8 9 10 |
# File 'lib/appli/command.rb', line 8 def debug? false end |