lib/sec_id/cusip.rb in sec_id-2.0.1 vs lib/sec_id/cusip.rb in sec_id-3.0.0
- old
+ new
@@ -30,18 +30,18 @@
# https://en.wikipedia.org/wiki/Luhn_algorithm
def modified_luhn_sum
sum = 0
- digitized_identifier.reverse.each_slice(2) do |even, odd|
+ id_digits.reverse.each_slice(2) do |even, odd|
double_even = (even || 0) * 2
sum += div_10_mod_10(double_even) + div_10_mod_10(odd || 0)
end
sum
end
- def digitized_identifier
- @digitized_identifier ||= identifier.each_char.map(&method(:char_to_digit))
+ def id_digits
+ @id_digits ||= identifier.each_char.map(&method(:char_to_digit))
end
end
end