Class: Ruby::Rego::Evaluator::ExpressionDispatch
- Inherits:
-
Object
- Object
- Ruby::Rego::Evaluator::ExpressionDispatch
- Defined in:
- lib/ruby/rego/evaluator/expression_dispatch.rb
Overview
Dispatches expression evaluation for primitive and AST nodes.
Instance Method Summary collapse
-
#dispatch_node(node, evaluator) ⇒ Value?
-
#initialize(primitive_types:, node_evaluators:) ⇒ ExpressionDispatch
constructor
A new instance of ExpressionDispatch.
-
#primitive_value(node) ⇒ Value?
Constructor Details
#initialize(primitive_types:, node_evaluators:) ⇒ ExpressionDispatch
Returns a new instance of ExpressionDispatch.
10 11 12 13 14 |
# File 'lib/ruby/rego/evaluator/expression_dispatch.rb', line 10 def initialize(primitive_types:, node_evaluators:) @primitive_types = primitive_types @node_evaluators = node_evaluators @handler_cache = {} # @type var handler_cache: Hash[Class, Proc?] end |
Instance Method Details
#dispatch_node(node, evaluator) ⇒ Value?
27 28 29 30 |
# File 'lib/ruby/rego/evaluator/expression_dispatch.rb', line 27 def dispatch_node(node, evaluator) handler = handler_for(node) handler&.call(node, evaluator) end |