Class: BrDocuments::IE::TO
- Defined in:
- lib/br_documents/ie/to.rb
Instance Method Summary collapse
-
#initialize(number) ⇒ TO
constructor
A new instance of TO.
Methods included from Commons::Mod11
#generate_digital_check, #reduce_weights
Methods inherited from Base
Constructor Details
#initialize(number) ⇒ TO
Returns a new instance of TO.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/br_documents/ie/to.rb', line 6 def initialize(number) super if number.gsub(/(\.)|(\-)/, "").length == 9 @mask = /^(\d{2}\.\d{6}\-\d{1})$|^(\d{9})$/ @weight = [9, 8, 7, 6, 5, 4, 3, 2] else @mask = /^(\d{2}\.\d{2}\.\d{6}\-\d{1})$|^(\d{11})$/ @weight = [9, 8, 0, 0, 7, 6, 5, 4, 3, 2] end end |