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

Returns:

  • (Object)

    the current value of opts



170
171
172
# File 'lib/business_flow/step.rb', line 170

def opts
  @opts
end

Instance Method Details

#conditionObject



182
183
184
185
186
187
188
189
190
# File 'lib/business_flow/step.rb', line 182

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
end

#input_objectObject



171
172
173
174
# File 'lib/business_flow/step.rb', line 171

def input_object
  inputs = opts[:inputs]
  inputs.present? ? Inputs.new(inputs) : nil
end

#result_factoryObject



176
177
178
179
180
# File 'lib/business_flow/step.rb', line 176

def result_factory
  ResultFactory.new(opts[:outputs],
                    opts[:output],
                    opts[:default_output])
end