Module: Teckel::Chain::InstanceMethods

Defined in:
lib/teckel/chain.rb

Instance Method Summary collapse

Instance Method Details

#call!(steps, input) ⇒ Object



162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/teckel/chain.rb', line 162

def call!(steps, input)
  result = input
  failed = nil
  steps.each do |(name, step)|
    result = step.call(result)
    if result.failure?
      failed = StepFailure.new(step, name, result)
      break
    end
  end

  failed || result
end