Class: Docopt::ParentPattern

Inherits:
Pattern
  • Object
show all
Defined in:
lib/docopt.rb

Direct Known Subclasses

Either, OneOrMore, Optional, Required

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Pattern

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

Constructor Details

#initialize(*children) ⇒ ParentPattern

Returns a new instance of ParentPattern.



163
164
165
# File 'lib/docopt.rb', line 163

def initialize(*children)
  @children = children
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



161
162
163
# File 'lib/docopt.rb', line 161

def children
  @children
end

Instance Method Details

#flatObject



172
173
174
# File 'lib/docopt.rb', line 172

def flat
  self.children.map { |c| c.flat }.flatten
end

#inspectObject



167
168
169
170
# File 'lib/docopt.rb', line 167

def inspect
  childstr = self.children.map { |a| a.inspect }
  return "#{self.class.name}(#{childstr.join(", ")})"
end