Class: Morpher::Transform::Boolean
- Inherits:
-
Morpher::Transform
- Object
- Morpher::Transform
- Morpher::Transform::Boolean
- Defined in:
- lib/morpher/transform.rb
Overview
Transform guarding boolean primitives
Constant Summary collapse
- MESSAGE =
'Expected: boolean but got: %<actual>s'
Instance Method Summary collapse
-
#call(input) ⇒ Either<Error, Object>
Apply transformation to input.
Methods inherited from Morpher::Transform
#array, #maybe, #seq, #slug, #to_proc
Instance Method Details
#call(input) ⇒ Either<Error, Object>
Apply transformation to input
249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/morpher/transform.rb', line 249 def call(input) if input.equal?(true) || input.equal?(false) success(input) else failure( error( message: MESSAGE % { actual: input.inspect }, input: input ) ) end end |