Sha256: 39225508a943fd171e21306c27062bcef75ebcded154c8c3b6edc818eaf42f72

Contents?: true

Size: 305 Bytes

Versions: 2

Compression:

Stored size: 305 Bytes

Contents

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

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

class String
  def mod11 digits = 1, options = {}
    (Mod11.new(self, options) * digits).to_s
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brid-0.2.1 lib/brid/algorithms/mod11.rb
brid-0.2.0 lib/brid/algorithms/mod11.rb