Class: Morpher::Transform::Array

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

Overview

Transform an array via mapping it over transform

Constant Summary collapse

MESSAGE =
'Failed to coerce array at index: %<index>d'
PRIMITIVE =
Primitive.new(::Array)

Instance Method Summary collapse

Methods inherited from Morpher::Transform

#array, #maybe, #seq, #slug, #to_proc

Instance Method Details

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

Apply transformation to input

Parameters:

  • input (Object)

Returns:



277
278
279
280
281
282
# File 'lib/morpher/transform.rb', line 277

def call(input)
  PRIMITIVE
    .call(input)
    .lmap(&method(:lift_error))
    .bind(&method(:run))
end