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.
Class Method Details
.wrap(cause, index) ⇒ Error
Create error at specified index
144 145 146 147 148 149 150 151 |
# File 'lib/morpher/transform.rb', line 144 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
158 159 160 |
# File 'lib/morpher/transform.rb', line 158 def call(input) transform.call(input).lmap(&method(:wrap_error)) end |
#slug ⇒ Array<String>
Rendering slug
165 166 167 |
# File 'lib/morpher/transform.rb', line 165 def slug '%<index>d' % { index: index } end |