Class: CircuitBreaker::Executors::BaseExecutor

Inherits:
Object
  • Object
show all
Includes:
DSL
Defined in:
lib/circuit_breaker/executors/base_executor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DSL

included, #validate_parameters

Constructor Details

#initialize(context = {}) ⇒ BaseExecutor

Returns a new instance of BaseExecutor.



10
11
12
13
14
# File 'lib/circuit_breaker/executors/base_executor.rb', line 10

def initialize(context = {})
  @context = context
  @result = nil
  validate_parameters
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



8
9
10
# File 'lib/circuit_breaker/executors/base_executor.rb', line 8

def context
  @context
end

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/circuit_breaker/executors/base_executor.rb', line 8

def result
  @result
end

Instance Method Details

#executeObject



16
17
18
19
20
21
# File 'lib/circuit_breaker/executors/base_executor.rb', line 16

def execute
  run_before_hooks
  execute_internal
  run_after_hooks
  @result
end