lib/luhn.rb in moeffju-luhn-0.1.2 vs lib/luhn.rb in moeffju-luhn-0.1.3

- old
+ new

@@ -2,10 +2,10 @@ class Numeric def luhn digits = self.to_s.chars.map(&:to_i) sum = digits.reverse.each_with_index.map{ |x, i| i.even? ? (x * 2).divmod(10).inject(:+) : x }.reverse.inject(:+) - (10 - sum % 10) + (10 - sum % 10) % 10 end def luhn? self.div(10).luhn == (self % 10) end