Class: ValidatorIE::StateAC
- Inherits:
-
Object
- Object
- ValidatorIE::StateAC
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/validator_ie/core/state_ac.rb
Instance Attribute Summary collapse
-
#number ⇒ Object
Returns the value of attribute number.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ StateAC
constructor
A new instance of StateAC.
- #number_should_mod11 ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ StateAC
Returns a new instance of StateAC.
10 11 12 13 14 |
# File 'lib/validator_ie/core/state_ac.rb', line 10 def initialize(opts={}) opts.each do |key, value| self.public_send("#{key}=", value) end end |
Instance Attribute Details
#number ⇒ Object
Returns the value of attribute number.
6 7 8 |
# File 'lib/validator_ie/core/state_ac.rb', line 6 def number @number end |
Instance Method Details
#number_should_mod11 ⇒ Object
16 17 18 19 20 21 |
# File 'lib/validator_ie/core/state_ac.rb', line 16 def number_should_mod11 result1 = number_should_modX(11, number.size - 3, 9) result2 = number_should_modX(11, number.size - 2, 9) return if result1 && result2 errors.add(:number, 'não é válido para inscrição estadual.') end |