Class: Kerplutz::Action
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#continue_after_exec ⇒ Object
Returns the value of attribute continue_after_exec.
Attributes inherited from Option
Class Method Summary collapse
Instance Method Summary collapse
- #configure(parser, &blk) ⇒ Object
-
#initialize(name, desc, &action) ⇒ Action
constructor
A new instance of Action.
Methods inherited from Option
#abbrev_sig, #display_name, #option_sig, #parser_args
Constructor Details
#initialize(name, desc, &action) ⇒ Action
Returns a new instance of Action.
99 100 101 102 |
# File 'lib/kerplutz/options.rb', line 99 def initialize(name, desc, &action) super(name, desc) @action = action end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
91 92 93 |
# File 'lib/kerplutz/options.rb', line 91 def action @action end |
#continue_after_exec ⇒ Object
Returns the value of attribute continue_after_exec.
91 92 93 |
# File 'lib/kerplutz/options.rb', line 91 def continue_after_exec @continue_after_exec end |
Class Method Details
.build(name, desc, opts, &action) ⇒ Object
93 94 95 96 97 |
# File 'lib/kerplutz/options.rb', line 93 def self.build(name, desc, opts, &action) new_action = super(name, desc, opts) new_action.action = action new_action end |
Instance Method Details
#configure(parser, &blk) ⇒ Object
104 105 106 107 108 109 |
# File 'lib/kerplutz/options.rb', line 104 def configure(parser, &blk) parser.on(*parser_args) do action.call exit unless continue_after_exec end end |