class Morpher::Transform::Index

Index attached to a transform

Public Class Methods

wrap(cause, index) click to toggle source

Create error at specified index

@param [Error] cause @param [Integer] index

@return [Error]

# File lib/morpher/transform.rb, line 174
def self.wrap(cause, index)
  Error.new(
    cause:     cause,
    input:     cause.input,
    message:   nil,
    transform: new(index: index, transform: cause.transform)
  )
end

Public Instance Methods

call(input) click to toggle source

Apply transformation to input

@param [Object] input

@return [Either<Error, Object>]

# File lib/morpher/transform.rb, line 188
def call(input)
  transform.call(input).lmap(&method(:wrap_error))
end
slug() click to toggle source

Rendering slug

@return [Array<String>]

# File lib/morpher/transform.rb, line 195
def slug
  '%<index>d' % { index: index }
end