Class: Dolla::PaymentSlip::Amount
- Inherits:
-
Object
- Object
- Dolla::PaymentSlip::Amount
- Defined in:
- lib/dolla/payment_slip/amount.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(number) ⇒ Amount
constructor
A new instance of Amount.
Constructor Details
#initialize(number) ⇒ Amount
Returns a new instance of Amount.
8 9 10 |
# File 'lib/dolla/payment_slip/amount.rb', line 8 def initialize number @value = format_amount number end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/dolla/payment_slip/amount.rb', line 4 def value @value end |
Instance Method Details
#hash ⇒ Object
12 13 14 15 16 17 |
# File 'lib/dolla/payment_slip/amount.rb', line 12 def hash filler_string = "".ljust( length, "731" ).reverse (0..length-1).inject(0) do |sum, position| sum + value[ position, 1 ].to_i * filler_string[ position, 1 ].to_i end % 10 end |