Class: Jan::CheckDigit

Inherits:
String
  • Object
show all
Defined in:
lib/jan/check_digit.rb

Instance Method Summary collapse

Constructor Details

#initialize(check_digit) ⇒ CheckDigit

Returns a new instance of CheckDigit.

Parameters:

  • check_digit (String)


4
5
6
7
# File 'lib/jan/check_digit.rb', line 4

def initialize(check_digit)
  @check_digit = check_digit
  super(check_digit)
end

Instance Method Details

#valid?boolean

Returns:

  • (boolean)


10
11
12
# File 'lib/jan/check_digit.rb', line 10

def valid?
  @check_digit.match?(/\A\d\z/)
end