class PasswordValidator

Constants

REGEXP

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
Calls superclass method BaseValidator#validate_each
# File lib/lite/validators/password_validator.rb, line 10
def validate_each(record, attribute, value)
  assert_valid_strength!
  super
end

Private Instance Methods

assert_valid_strength!() click to toggle source
# File lib/lite/validators/password_validator.rb, line 17
def assert_valid_strength!
  assert_valid_option!(:strength, REGEXP.keys)
end
strength() click to toggle source
# File lib/lite/validators/password_validator.rb, line 21
def strength
  options[:strength] || :weak
end
valid_regexp?() click to toggle source
# File lib/lite/validators/password_validator.rb, line 25
def valid_regexp?
  value.to_s =~ REGEXP[strength]
end