Class: Calyx::Grammar::Production::Expression

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

Instance Method Summary collapse

Constructor Details

#initialize(production, methods) ⇒ Expression

Returns a new instance of Expression.



60
61
62
63
# File 'lib/calyx.rb', line 60

def initialize(production, methods)
  @production = production
  @methods = methods.map { |m| m.to_sym }
end

Instance Method Details

#evaluateObject



65
66
67
68
69
# File 'lib/calyx.rb', line 65

def evaluate
  @methods.reduce(@production.evaluate) do |value,method|
    value.send(method)
  end
end