Module: ServiceOperator::Helpers

Defined in:
lib/service_operator/helpers.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/service_operator/helpers.rb', line 10

def self.included(base)
  base.class_eval do
    extend ClassMethods
    include Steps
    include Hooks

    attr_reader :context
  end
end

Instance Method Details

#callObject



47
48
49
50
51
52
53
# File 'lib/service_operator/helpers.rb', line 47

def call
  with_hooks { run_steps(self.class.steps) }
  context
# rescue catches errors in before and after steps and stops execution
rescue StandardError
  context
end

#configurationObject



55
56
57
# File 'lib/service_operator/helpers.rb', line 55

def configuration
  ServiceOperator.instance
end

#initialize(args = {}) ⇒ Object



42
43
44
45
# File 'lib/service_operator/helpers.rb', line 42

def initialize(args={})
  @context = Context.build(args)
  @context.validate(required_params: self.class.required_params)
end