Class: EasyJSONMatcher::BooleanValidator
- Defined in:
- lib/easy_json_matcher/boolean_validator.rb
Instance Attribute Summary
Attributes inherited from Validator
#content, #errors, #key, #required
Instance Method Summary collapse
Methods inherited from Validator
#_check_content_type, #_check_required?, #_create_validator, #_no_errors?, #_post_initialise, #_set_content, #get_errors, #initialize, #reset!, #valid?
Constructor Details
This class inherits a constructor from EasyJSONMatcher::Validator
Instance Method Details
#_content_is_boolean? ⇒ Boolean
9 10 11 12 |
# File 'lib/easy_json_matcher/boolean_validator.rb', line 9 def _content_is_boolean? clazz = content.class (clazz == TrueClass) || (clazz == FalseClass) end |
#_validate ⇒ Object
5 6 7 |
# File 'lib/easy_json_matcher/boolean_validator.rb', line 5 def _validate errors << "#{content} is not a Boolean" unless _content_is_boolean? end |