class HashValidator::Validator::BooleanValidator
Public Class Methods
new()
click to toggle source
Calls superclass method
HashValidator::Validator::Base::new
# File lib/hash_validator/validators/boolean_validator.rb, line 2 def initialize super('boolean') # The name of the validator end
Public Instance Methods
validate(key, value, _validations, errors)
click to toggle source
# File lib/hash_validator/validators/boolean_validator.rb, line 6 def validate(key, value, _validations, errors) unless [TrueClass, FalseClass].include?(value.class) errors[key] = presence_error_message end end