Class: Mod11

Inherits:
LuhnBase show all
Defined in:
lib/brid/algorithms/mod11.rb

Instance Method Summary collapse

Methods inherited from LuhnBase

#*, #+, #==, #to_s

Constructor Details

#initialize(number, options = {}) ⇒ Mod11

Returns a new instance of Mod11.



2
3
4
5
# File 'lib/brid/algorithms/mod11.rb', line 2

def initialize number, options = {}
  options[:mod] = 11
  super number, {:base => 2..11}.merge(options)
end

Instance Method Details

#check_digitObject



7
8
9
# File 'lib/brid/algorithms/mod11.rb', line 7

def check_digit
  ((10 * sum) % @mod) % 10
end