Class: Mutant::Transform::Primitive Private
- Inherits:
-
Mutant::Transform
- Object
- Mutant::Transform
- Mutant::Transform::Primitive
- 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.
Transform guarding a specific primitive
Constant Summary collapse
- MESSAGE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'Expected: %<expected>s but got: %<actual>s'
Instance Method Summary collapse
-
#call(input) ⇒ Either<Error, Object>
private
Apply transformation to input.
-
#slug ⇒ String
private
Rendering slug.
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
180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/mutant/transform.rb', line 180 def call(input) if input.instance_of?(primitive) success(input) else failure( error( input:, message: MESSAGE % { actual: input.class, expected: primitive } ) ) end end |
#slug ⇒ 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
196 197 198 |
# File 'lib/mutant/transform.rb', line 196 def slug primitive.to_s end |