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
14 15 16 |
# File 'lib/rschema/schemas/boolean.rb', line 14 def self.instance @instance ||= new end |
Instance Method Details
#call(value, options) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rschema/schemas/boolean.rb', line 18 def call(value, ) if value.equal?(true) || value.equal?(false) Result.success(value) else Result.failure(Error.new( schema: self, value: value, symbolic_name: :not_a_boolean, )) end end |
#with_wrapped_subschemas(wrapper) ⇒ Object
30 31 32 |
# File 'lib/rschema/schemas/boolean.rb', line 30 def with_wrapped_subschemas(wrapper) self end |