Class: BankSlip::CheckDigit

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

Instance Method Summary collapse

Constructor Details

#initialize(number:) ⇒ CheckDigit

Returns a new instance of CheckDigit.



3
4
5
# File 'lib/bank_slip/check_digit.rb', line 3

def initialize(number:)
  @number = number
end

Instance Method Details

#calcObject



7
8
9
10
# File 'lib/bank_slip/check_digit.rb', line 7

def calc
  r = result
  r == 10 ? 0 : r
end