Class: Ref

Inherits:
Combinator show all
Defined in:
lib/hivemind/combinators.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Combinator

#&, #|

Constructor Details

#initialize(label, as: nil) ⇒ Ref

Returns a new instance of Ref.



145
146
147
148
# File 'lib/hivemind/combinators.rb', line 145

def initialize(label, as: nil)
  @label = label
  @as = as
end

Instance Attribute Details

#labelObject

Returns the value of attribute label.



143
144
145
# File 'lib/hivemind/combinators.rb', line 143

def label
  @label
end

Instance Method Details

#parse(input, refs) ⇒ Object



150
151
152
153
# File 'lib/hivemind/combinators.rb', line 150

def parse(input, refs)
  ref_parser = refs[@label.to_sym]
  ref_parser.parse(input, refs)
end