Class: Cel::Program
- Inherits:
-
Object
- Object
- Cel::Program
- Defined in:
- lib/cel/program.rb
Instance Method Summary collapse
- #evaluate(ast) ⇒ Object (also: #call)
-
#initialize(context) ⇒ Program
constructor
A new instance of Program.
Constructor Details
#initialize(context) ⇒ Program
Returns a new instance of Program.
5 6 7 |
# File 'lib/cel/program.rb', line 5 def initialize(context) @context = context end |
Instance Method Details
#evaluate(ast) ⇒ Object Also known as: call
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cel/program.rb', line 9 def evaluate(ast) case ast when Group evaluate(ast.value) when Invoke evaluate_invoke(ast) when Operation evaluate_operation(ast) when Message ast.struct when Literal evaluate_literal(ast) when Identifier evaluate_identifier(ast) when Condition evaluate_condition(ast) end end |