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

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

Instance Method Summary collapse

Constructor Details

#initialize(production, methods) ⇒ Expression

Returns a new instance of Expression.



5
6
7
8
# File 'lib/calyx/grammar/production/expression.rb', line 5

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

Instance Method Details

#evaluateObject



10
11
12
13
14
# File 'lib/calyx/grammar/production/expression.rb', line 10

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