Class: BusinessFlow::Step::Inputs
- Inherits:
-
Object
- Object
- BusinessFlow::Step::Inputs
- Defined in:
- lib/business_flow/step.rb
Overview
Represents inputs needed to execute a step.
Instance Attribute Summary collapse
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(inputs) ⇒ Inputs
constructor
A new instance of Inputs.
- #parameters_from_source(source) ⇒ Object
Constructor Details
#initialize(inputs) ⇒ Inputs
Returns a new instance of Inputs.
11 12 13 |
# File 'lib/business_flow/step.rb', line 11 def initialize(inputs) @inputs = inputs end |
Instance Attribute Details
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
9 10 11 |
# File 'lib/business_flow/step.rb', line 9 def inputs @inputs end |
Class Method Details
.process_input(source, input_value) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/business_flow/step.rb', line 26 def self.process_input(source, input_value) case input_value when Symbol source.send(input_value) when Proc source.instance_exec(&input_value) else input_value end end |
Instance Method Details
#parameters_from_source(source) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/business_flow/step.rb', line 15 def parameters_from_source(source) return source if inputs.blank? inputs.to_h do |input_name, input_value| # rubocop:disable Style/HashTransformValues [ input_name, Inputs.process_input(source, input_value) ] end end |