Class: Morpher::Transform::Index
- Inherits:
-
Morpher::Transform
- Object
- Morpher::Transform
- Morpher::Transform::Index
- Defined in:
- lib/morpher/transform.rb
Overview
Index attached to a transform
Class Method Summary collapse
-
.wrap(cause, index) ⇒ Error
Create error at specified index.
Instance Method Summary collapse
-
#call(input) ⇒ Either<Error, Object>
Apply transformation to input.
-
#slug ⇒ Array<String>
Rendering slug.
Methods inherited from Morpher::Transform
#array, #maybe, #seq, #to_proc
Class Method Details
.wrap(cause, index) ⇒ Error
Create error at specified index
174 175 176 177 178 179 180 181 |
# 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 |
Instance Method Details
#call(input) ⇒ Either<Error, Object>
Apply transformation to input
188 189 190 |
# File 'lib/morpher/transform.rb', line 188 def call(input) transform.call(input).lmap(&method(:wrap_error)) end |
#slug ⇒ Array<String>
Rendering slug
195 196 197 |
# File 'lib/morpher/transform.rb', line 195 def slug '%<index>d' % { index: index } end |