lib/sec_id/isin.rb in sec_id-2.0.1 vs lib/sec_id/isin.rb in sec_id-3.0.0
- old
+ new
@@ -30,19 +30,19 @@
# https://en.wikipedia.org/wiki/Luhn_algorithm
def 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
double_even -= 9 if double_even > 9
sum += double_even + (odd || 0)
end
sum
end
- def digitized_identifier
- @digitized_identifier ||= identifier.each_char.flat_map(&method(:char_to_digits))
+ def id_digits
+ @id_digits ||= identifier.each_char.flat_map(&method(:char_to_digits))
end
end
end