Class: Veto::DoesntEqualAttributeCheck

Inherits:
AttributeCheck
  • Object
show all
Includes:
AgainstAttributeCco
Defined in:
lib/veto_checks.rb

Constant Summary collapse

MSG =
"matches %s"

Constants included from AgainstAttributeCco

AgainstAttributeCco::MSG_MISSING_ATTR

Instance Method Summary collapse

Methods included from AgainstAttributeCco

#call

Instance Method Details

#check(attribute, value, against, errors, options = {}) ⇒ Object



68
69
70
71
# File 'lib/veto_checks.rb', line 68

def check(attribute, value, against, errors, options={})
  errors.add(options.fetch(:on, attribute), 
    (options[:message] || MSG) % options[:attribute] ) if value == against
end