Class: VanillaValidator::Rules::Eq

Inherits:
BaseRule
  • Object
show all
Defined in:
lib/vanilla_validator/rules/eq.rb

Instance Attribute Summary

Attributes inherited from BaseRule

#attribute, #parameters, #value

Instance Method Summary collapse

Methods inherited from BaseRule

#initialize

Constructor Details

This class inherits a constructor from VanillaValidator::Rules::BaseRule

Instance Method Details

#failure_messageObject



8
9
10
# File 'lib/vanilla_validator/rules/eq.rb', line 8

def failure_message
  I18n.t("eq", attribute: attribute, value: parameters[0].to_i)
end

#valid?Boolean

Returns:



4
5
6
# File 'lib/vanilla_validator/rules/eq.rb', line 4

def valid?
	value == parameters[0].to_i
end