Class: Oyster::ShortcutOption
- Defined in:
- lib/oyster/options/shortcut.rb
Instance Method Summary collapse
- #consume(list) ⇒ Object
- #description ⇒ Object
-
#initialize(name, expansion, options = {}) ⇒ ShortcutOption
constructor
A new instance of ShortcutOption.
Methods inherited from Option
#alternate, create, #default_value, #has_name?, #help_names, #name
Constructor Details
#initialize(name, expansion, options = {}) ⇒ ShortcutOption
Returns a new instance of ShortcutOption.
4 5 6 7 |
# File 'lib/oyster/options/shortcut.rb', line 4 def initialize(name, expansion, = {}) super(name, ) @expansion = expansion.split(/\s+/).reverse end |
Instance Method Details
#consume(list) ⇒ Object
9 10 11 12 |
# File 'lib/oyster/options/shortcut.rb', line 9 def consume(list) @expansion.each { |e| list.unshift(e) } nil end |
#description ⇒ Object
14 15 16 |
# File 'lib/oyster/options/shortcut.rb', line 14 def description "Same as '#{@expansion.reverse.join(' ')}'" end |