Class: BankSlip::CheckDigit
- Inherits:
-
Object
- Object
- BankSlip::CheckDigit
- Defined in:
- lib/bank_slip/check_digit.rb
Instance Method Summary collapse
- #calc ⇒ Object
-
#initialize(number:) ⇒ CheckDigit
constructor
A new instance of CheckDigit.
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
#calc ⇒ Object
7 8 9 10 |
# File 'lib/bank_slip/check_digit.rb', line 7 def calc r = result r == 10 ? 0 : r end |