Class: RSchema::Schemas::Boolean
- Inherits:
-
Object
- Object
- RSchema::Schemas::Boolean
- Defined in:
- lib/rschema/schemas/boolean.rb
Overview
A schema that matches only ‘true` and `false`
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.instance ⇒ Object
15 16 17 |
# File 'lib/rschema/schemas/boolean.rb', line 15 def self.instance @instance ||= new end |
Instance Method Details
#call(value, _options) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/rschema/schemas/boolean.rb', line 19 def call(value, ) if value.equal?(true) || value.equal?(false) Result.success(value) else Result.failure(error(value)) end end |
#with_wrapped_subschemas(_wrapper) ⇒ Object
27 28 29 |
# File 'lib/rschema/schemas/boolean.rb', line 27 def with_wrapped_subschemas(_wrapper) self end |