Module: BusinessPipeline::Step
- Defined in:
- lib/business_pipeline/step.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
- #fail!(additional_context = {}) ⇒ Object
- #initialize(config = {}) ⇒ Object
- #perform(context = {}) ⇒ Object
- #succeed!(additional_context = {}) ⇒ Object
Class Method Details
.included(base) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/business_pipeline/step.rb', line 9 def self.included(base) base.class_eval do include Hooks attr_reader :context private :context attr_reader :config private :config def self.inherited(child_class) child_class.instance_variable_set(:@hooks, hooks.clone) end end end |
Instance Method Details
#call ⇒ Object
29 30 31 |
# File 'lib/business_pipeline/step.rb', line 29 def call fail NotImplementedError end |
#fail!(additional_context = {}) ⇒ Object
33 34 35 |
# File 'lib/business_pipeline/step.rb', line 33 def fail!(additional_context = {}) context.fail!(additional_context) end |
#initialize(config = {}) ⇒ Object
25 26 27 |
# File 'lib/business_pipeline/step.rb', line 25 def initialize(config = {}) @config = BusinessPipeline::Config.new(config) end |
#perform(context = {}) ⇒ Object
37 38 39 40 41 |
# File 'lib/business_pipeline/step.rb', line 37 def perform(context = {}) @context = BusinessPipeline::Context.build(context) with_hooks { call } @context end |
#succeed!(additional_context = {}) ⇒ Object
43 44 45 |
# File 'lib/business_pipeline/step.rb', line 43 def succeed!(additional_context = {}) context.succeed!(additional_context) end |