Class: Mutant::Transform::Index Private

Inherits:
Mutant::Transform show all
Defined in:
lib/mutant/transform.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Index attached to a transform

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.wrap(cause, index) ⇒ Error

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create error at specified index

Parameters:

  • cause (Error)
  • index (Integer)

Returns:



140
141
142
143
144
145
146
147
# File 'lib/mutant/transform.rb', line 140

def self.wrap(cause, index)
  Error.new(
    cause:,
    input:     cause.input,
    message:   nil,
    transform: new(index:, transform: cause.transform)
  )
end

Instance Method Details

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Apply transformation to input

Parameters:

  • input (Object)

Returns:



154
155
156
# File 'lib/mutant/transform.rb', line 154

def call(input)
  transform.call(input).lmap(&method(:wrap_error))
end

#slugArray<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Rendering slug

Returns:



161
162
163
# File 'lib/mutant/transform.rb', line 161

def slug
  '%<index>d' % { index: }
end