Class: Docopt::Required

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

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



298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/docopt.rb', line 298

def match(left, collected=nil)
  collected ||= []
  l = left
  c = collected

  for p in self.children
    matched, l, c = p.match(l, c)
    if not matched
      return [false, left, collected]
    end
  end
  return [true, l, c]
end