Class: Codabel::Type::Amount

Inherits:
Codabel::Type show all
Defined in:
lib/codabel/type/amount.rb

Instance Method Summary collapse

Methods inherited from Codabel::Type

#check!

Instance Method Details

#to_coda(value, length) ⇒ Object



4
5
6
7
8
# File 'lib/codabel/type/amount.rb', line 4

def to_coda(value, length)
  check!(value.is_a?(Integer), 'All amounts must be in cents')

  (value.abs * 10).to_s.rjust(length, '0')
end