Class: Docopt::Command
- Inherits:
-
Argument
- Object
- Pattern
- ChildPattern
- Argument
- Docopt::Command
- Defined in:
- lib/docopt.rb
Instance Attribute Summary
Attributes inherited from ChildPattern
Attributes inherited from Pattern
Instance Method Summary collapse
-
#initialize(name, value = false) ⇒ Command
constructor
A new instance of Command.
- #single_match(left) ⇒ Object
Methods inherited from ChildPattern
Methods inherited from Pattern
#==, #dump, #either, #fix, #fix_identities, #fix_list_arguments, #to_str
Constructor Details
#initialize(name, value = false) ⇒ Command
Returns a new instance of Command.
195 196 197 198 |
# File 'lib/docopt.rb', line 195 def initialize(name, value=false) @name = name @value = value end |
Instance Method Details
#single_match(left) ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/docopt.rb', line 200 def single_match(left) left.each_with_index do |p, n| if p.class == Argument if p.value == self.name return n, Command.new(self.name, true) else break end end end return [nil, nil] end |