class AlphaValidator
Constants
- CASES
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
Calls superclass method
BaseValidator#validate_each
# File lib/lite/validators/alpha_validator.rb, line 11 def validate_each(record, attribute, value) assert_valid_case! super end
Private Instance Methods
assert_valid_case!()
click to toggle source
# File lib/lite/validators/alpha_validator.rb, line 18 def assert_valid_case! assert_valid_option!(:case, CASES.keys, option: kase) end
kase()
click to toggle source
# File lib/lite/validators/alpha_validator.rb, line 22 def kase options[:case] || :any end
regexp()
click to toggle source
# File lib/lite/validators/alpha_validator.rb, line 26 def regexp /^[#{CASES[kase]}#{' ' if options[:allow_space]}]+$/ end
valid_regexp?()
click to toggle source
# File lib/lite/validators/alpha_validator.rb, line 30 def valid_regexp? value.to_s =~ regexp end