Class: Docopt::Optional

Inherits:
ParentPattern show all
Defined in:
lib/docopt.rb

Direct Known Subclasses

AnyOptions

Instance Attribute Summary

Attributes inherited from ParentPattern

#children

Attributes inherited from Pattern

#children

Instance Method Summary collapse

Methods inherited from ParentPattern

#flat, #initialize, #inspect

Methods inherited from Pattern

#==, #dump, #either, #fix, #fix_identities, #fix_repeating_arguments, #to_str

Constructor Details

This class inherits a constructor from Docopt::ParentPattern

Instance Method Details

#match(left, collected = nil) ⇒ Object


314
315
316
317
318
319
320
# File 'lib/docopt.rb', line 314

def match(left, collected=nil)
  collected ||= []
  for p in self.children
    _, left, collected = p.match(left, collected)
  end
  return [true, left, collected]
end