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



115
116
117
118
119
120
121
122
# File 'lib/mutant/transform.rb', line 115

def self.wrap(cause, index)
  Error.new(
    cause:     cause,
    input:     cause.input,
    message:   nil,
    transform: new(index: 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



129
130
131
# File 'lib/mutant/transform.rb', line 129

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



136
137
138
# File 'lib/mutant/transform.rb', line 136

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