Class: Calyx::Grammar::Production::Expression
- Inherits:
-
Object
- Object
- Calyx::Grammar::Production::Expression
- Defined in:
- lib/calyx.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.
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
#evaluate ⇒ Object
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 |