lib/br_documents/ie/rr.rb in br_documents-0.1.3 vs lib/br_documents/ie/rr.rb in br_documents-0.2.0
- old
+ new
@@ -1,6 +1,6 @@
-require_relative "pattern1"
+require_relative 'pattern1'
module BrDocuments
module IE
class RR < Pattern1
def initialize(number)
@@ -8,14 +8,15 @@
@mask = /^(\d{8}\-\d{1})$|^(\d{9})$/
@weight = [1, 2, 3, 4, 5, 6, 7, 8]
end
private
+
def format_ie(number)
- number.sub(/(\d{8})(\d{1})/, "\\1-\\2")
+ number.sub(/(\d{8})(\d{1})/, '\\1-\\2')
end
- def generate_digital_check(values, weights)
+ def generate_check_digit(values, weights)
sum = reduce_weights(values, weights)
sum % 9
end
end
end