Class: Calyx::Grammar::Production::Expression
- Inherits:
-
Object
- Object
- Calyx::Grammar::Production::Expression
- Defined in:
- lib/calyx/grammar/production/expression.rb
Instance Method Summary collapse
- #evaluate ⇒ Object
-
#initialize(production, methods) ⇒ Expression
constructor
A new instance of Expression.
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
#evaluate ⇒ Object
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 |