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



134
135
136
# File 'lib/business_flow/step.rb', line 134

def opts
  @opts
end

Instance Method Details

#conditionObject



144
145
146
147
148
149
150
151
152
# File 'lib/business_flow/step.rb', line 144

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



135
136
137
# File 'lib/business_flow/step.rb', line 135

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

#result_factoryObject



139
140
141
142
# File 'lib/business_flow/step.rb', line 139

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