Class: Noteikumi::RuleExecutionScope Private

Inherits:
Object
  • Object
show all
Defined in:
lib/noteikumi/rule_execution_scope.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A class that exist to execute the logic of the rule

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rule) ⇒ RuleExecutionScope

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new scope object

Parameters:



21
22
23
24
25
# File 'lib/noteikumi/rule_execution_scope.rb', line 21

def initialize(rule)
  @rule = rule
  @state = rule.state
  @logger = rule.logger
end

Instance Attribute Details

#loggerLogger (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The active logger

Returns:

  • (Logger)


15
16
17
# File 'lib/noteikumi/rule_execution_scope.rb', line 15

def logger
  @logger
end

#ruleRule (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The rule being ran

Returns:



7
8
9
# File 'lib/noteikumi/rule_execution_scope.rb', line 7

def rule
  @rule
end

#stateState (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The state the rule is processing

Returns:



11
12
13
# File 'lib/noteikumi/rule_execution_scope.rb', line 11

def state
  @state
end

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs the rule logic within this scope

Returns:

  • (Object)

    the output from the rule



30
31
32
# File 'lib/noteikumi/rule_execution_scope.rb', line 30

def run
  @rule.run_logic.call
end