Class: Farseer::Map

Inherits:
Object
  • Object
show all
Includes:
MapFactory
Defined in:
lib/farseer/map.rb

Instance Method Summary collapse

Methods included from MapFactory

#map

Constructor Details

#initialize(parser, &map) ⇒ Map

Returns a new instance of Map.



7
8
9
10
11
# File 'lib/farseer/map.rb', line 7

def initialize(parser, &map)
  @parser = parser
  @map = map
  freeze
end

Instance Method Details

#parse(input) ⇒ Object



13
14
15
# File 'lib/farseer/map.rb', line 13

def parse(input)
  @parser.parse(input).map { |r| Result.new(@map.call(r.token), r.rest) }
end