Class: Cel::Environment
- Inherits:
-
Object
- Object
- Cel::Environment
- Defined in:
- lib/cel/environment.rb
Instance Method Summary collapse
- #check(expr) ⇒ Object
- #compile(expr) ⇒ Object
- #evaluate(expr, bindings = nil) ⇒ Object
-
#initialize(declarations = nil) ⇒ Environment
constructor
A new instance of Environment.
- #program(expr) ⇒ Object
Constructor Details
#initialize(declarations = nil) ⇒ Environment
Returns a new instance of Environment.
5 6 7 8 9 |
# File 'lib/cel/environment.rb', line 5 def initialize(declarations = nil) @declarations = declarations @parser = Parser.new @checker = Checker.new(@declarations) end |
Instance Method Details
#check(expr) ⇒ Object
17 18 19 20 |
# File 'lib/cel/environment.rb', line 17 def check(expr) ast = @parser.parse(expr) @checker.check(ast) end |
#compile(expr) ⇒ Object
11 12 13 14 15 |
# File 'lib/cel/environment.rb', line 11 def compile(expr) ast = @parser.parse(expr) @checker.check(ast) ast end |