Class: Ruby::Rego::WithModifiers::WithModifierContext
- Inherits:
-
Object
- Object
- Ruby::Rego::WithModifiers::WithModifierContext
- Defined in:
- lib/ruby/rego/with_modifiers/with_modifier_context.rb
Overview
Applies a single with modifier in a given environment.
Instance Method Summary collapse
-
#apply {|environment| ... } ⇒ Object
-
#initialize(modifier:, environment:, expression_evaluator:) ⇒ WithModifierContext
constructor
A new instance of WithModifierContext.
Constructor Details
#initialize(modifier:, environment:, expression_evaluator:) ⇒ WithModifierContext
Returns a new instance of WithModifierContext.
20 21 22 23 24 |
# File 'lib/ruby/rego/with_modifiers/with_modifier_context.rb', line 20 def initialize(modifier:, environment:, expression_evaluator:) @modifier = modifier @environment = environment @expression_evaluator = expression_evaluator end |
Instance Method Details
#apply {|environment| ... } ⇒ Object
28 29 30 31 32 33 |
# File 'lib/ruby/rego/with_modifiers/with_modifier_context.rb', line 28 def apply(&) return apply_reference(&) if target.is_a?(AST::Reference) return apply_variable(&) if target.is_a?(AST::Variable) raise EvaluationError.new("Unsupported with target: #{target.class}", rule: nil, location: target.location) end |