Class: BusinessFlow::Step::Options

Inherits:
Struct
  • Object
show all
Defined in:
lib/business_flow/step.rb

Overview

Responsible for creating objects based on our input options

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optsObject

Returns the value of attribute opts



148
149
150
# File 'lib/business_flow/step.rb', line 148

def opts
  @opts
end

Instance Method Details

#conditionObject



158
159
160
161
162
163
164
165
166
# File 'lib/business_flow/step.rb', line 158

def condition
  opts.fetch(:condition) do
    if_stmts = opts[:if]
    unless_stmts = opts[:unless]
    if if_stmts.present? || unless_stmts.present?
      ConditionList.new(if_stmts, unless_stmts)
    end
  end || proc { true }
end

#input_objectObject



149
150
151
# File 'lib/business_flow/step.rb', line 149

def input_object
  Inputs.new(opts[:inputs] || {})
end

#result_factoryObject



153
154
155
156
# File 'lib/business_flow/step.rb', line 153

def result_factory
  ResultFactory.new(opts[:outputs] || {},
                    opts[:output] || ->(result) { result })
end