Class: Oyster::ShortcutOption

Inherits:
Option
  • Object
show all
Defined in:
lib/oyster/options/shortcut.rb

Instance Method Summary collapse

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, options = {})
  super(name, options)
  @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

#descriptionObject



14
15
16
# File 'lib/oyster/options/shortcut.rb', line 14

def description
  "Same as '#{@expansion.reverse.join(' ')}'"
end