lib/br_documents/ie/rn.rb in br_documents-0.0.10 vs lib/br_documents/ie/rn.rb in br_documents-0.0.11

- old
+ new

@@ -18,20 +18,20 @@ def valid_format? valid_old_format or valid_new_format end def valid_old_format - regex = /^(\d{2}\.\d{3}\.\d{3}\-\d{1}})$|^(\d{9})$/ + regex = /^(\d{2}\.\d{3}\.\d{3}\-\d{1})$|^(\d{9})$/ regex.match(@number).present? end def valid_new_format - regex = /^(\d{2}\.\d{1}\.\d{3}\.\d{3}\-\d{1}})$|^(\d{10})$/ + regex = /^(\d{2}\.\d{1}\.\d{3}\.\d{3}\-\d{1})$|^(\d{10})$/ regex.match(@number).present? end def valid_digital_check? - @number.gsub!(/\./, "") + @number.gsub!(/[\.\/-]/, "") weight = [] @number.length.downto(2).each {|w| weight << w } @number[-1].eql? generate_digital_check(@number, weight).to_s