class BooleanValidator
Constants
- CHECKS
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
Calls superclass method
BaseValidator#validate_each
# File lib/lite/validators/boolean_validator.rb, line 11 def validate_each(record, attribute, value) assert_valid_check! super end
Private Instance Methods
assert_valid_check!()
click to toggle source
# File lib/lite/validators/boolean_validator.rb, line 18 def assert_valid_check! assert_valid_option!(:check, CHECKS.keys) end
check()
click to toggle source
# File lib/lite/validators/boolean_validator.rb, line 22 def check options[:check] || :all end
error_message()
click to toggle source
# File lib/lite/validators/boolean_validator.rb, line 26 def error_message [options[:message] || I18n.t("errors.messages.boolean.#{check}")] end
valid_attr?()
click to toggle source
# File lib/lite/validators/boolean_validator.rb, line 30 def valid_attr? checks = CHECKS[check] || [].concat(CHECKS[:false_only], CHECKS[:true_only]) checks.include?(value.to_s.downcase) end