Class: Stannum::Constraints::Boolean
- Defined in:
- lib/stannum/constraints/boolean.rb
Overview
A Boolean constraint matches only true or false.
Constant Summary collapse
- NEGATED_TYPE =
The :type of the error generated for a matching object.
'stannum.constraints.is_boolean'
- TYPE =
The :type of the error generated for a non-matching object.
'stannum.constraints.is_not_boolean'
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#matches?(actual) ⇒ true, false
(also: #match?)
Checks that the object is either true or false.
Methods inherited from Base
#==, #clone, #does_not_match?, #dup, #errors_for, #initialize, #match, #message, #negated_errors_for, #negated_match, #negated_message, #negated_type, #type, #with_options
Constructor Details
This class inherits a constructor from Stannum::Constraints::Base
Instance Method Details
#matches?(actual) ⇒ true, false Also known as: match?
Checks that the object is either true or false.
28 29 30 |
# File 'lib/stannum/constraints/boolean.rb', line 28 def matches?(actual) true.equal?(actual) || false.equal?(actual) end |