Class: Morpher::Transform::Sequence

Inherits:
Morpher::Transform show all
Defined in:
lib/morpher/transform.rb

Overview

Sequence of transformations

Instance Method Summary collapse

Methods inherited from Morpher::Transform

#slug

Instance Method Details

#call(input) ⇒ Either<Error, Object>

Apply transformation to input

Parameters:

  • (Object)

Returns:



427
428
429
430
431
432
433
434
435
436
437
# File 'lib/morpher/transform.rb', line 427

def call(input)
  current = input

  steps.each_with_index do |step, index|
    current = step.call(current).from_right do |error|
      return failure(error(cause: Index.wrap(error, index), input: input))
    end
  end

  success(current)
end