Class: Oyster::SubcommandOption

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

Instance Attribute Summary

Attributes inherited from Option

#description

Instance Method Summary collapse

Methods inherited from Option

#alternate, create, #default_value, #has_name?, #help_names, #name

Constructor Details

#initialize(name, spec) ⇒ SubcommandOption

Returns a new instance of SubcommandOption.



4
5
6
7
# File 'lib/oyster/options/subcommand.rb', line 4

def initialize(name, spec)
  super(name)
  @spec = spec
end

Instance Method Details

#consume(list) ⇒ Object



9
10
11
12
13
# File 'lib/oyster/options/subcommand.rb', line 9

def consume(list)
  output = @spec.parse(list)
  list.clear
  output
end

#parse(*args) ⇒ Object



15
16
17
# File 'lib/oyster/options/subcommand.rb', line 15

def parse(*args)
  @spec.parse(*args)
end