Class: Valideez::Siret
- Includes:
- Common
- Defined in:
- lib/valideez/siret.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(val, options = {}) ⇒ Siret
constructor
A new instance of Siret.
- #validate_sum_control ⇒ Object
Methods included from Common
#validate_format, #validate_length
Methods inherited from Base
Constructor Details
#initialize(val, options = {}) ⇒ Siret
Returns a new instance of Siret.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/valideez/siret.rb', line 5 def initialize(val, = {}) super val assign({ :format => /\A\d{14}\Z/, :length => 14, :mask => (1..14).to_a.map { |u| u % 2 + 1 }, :modulo => 10, :sum_control => true, }.merge()) @arr = [] end |
Instance Method Details
#validate_sum_control ⇒ Object
19 20 21 22 |
# File 'lib/valideez/siret.rb', line 19 def validate_sum_control mod = checksum % modulo mod === 0 end |