Class: Ruby::Rego::WithModifiers::WithModifierApplier

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/rego/with_modifiers/with_modifier_applier.rb

Overview

Applies a sequence of with modifiers around a block.

Class Method Summary collapse

Class Method Details

.apply(modifiers, environment, expression_evaluator) {|environment| ... } ⇒ Object

Parameters:

Yield Parameters:

Returns:

  • (Object)


15
16
17
18
19
20
# File 'lib/ruby/rego/with_modifiers/with_modifier_applier.rb', line 15

def self.apply(modifiers, environment, expression_evaluator, &block)
  block ||= ->(_env) {}
  return block.call(environment) if modifiers.empty?

  build_chain(modifiers, expression_evaluator, block).call(environment)
end