Class: DocoptNG::Optional
- Inherits:
-
ParentPattern
- Object
- Pattern
- ParentPattern
- DocoptNG::Optional
- Defined in:
- lib/docopt_ng/optional.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from ParentPattern
Attributes inherited from Pattern
Instance Method Summary collapse
Methods inherited from ParentPattern
Methods inherited from Pattern
#==, #dump, #either, #fix, #fix_identities, #fix_repeating_arguments, #to_str
Constructor Details
This class inherits a constructor from DocoptNG::ParentPattern
Instance Method Details
#match(left, collected = nil) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/docopt_ng/optional.rb', line 5 def match(left, collected = nil) collected ||= [] children.each do |p| _, left, collected = p.match(left, collected) end [true, left, collected] end |