class Qiflib::Money

Instances of this class represent a dollar amount values from within a qif file.

Attributes

string_value[R]

Public Class Methods

new(s='0.00') click to toggle source
# File lib/qiflib_money.rb, line 10
def initialize(s='0.00')
  @string_value = "#{s}".tr('TBL, ' , '') 
  if @string_value.size < 1
    @string_value = '0.00'
  end
  if @string_value.end_with?('.')
    @string_value = "#{string_value}00"
  end
end

Public Instance Methods

cents() click to toggle source
# File lib/qiflib_money.rb, line 24
def cents
  string_value.tr("$.","").to_i
end
to_s() click to toggle source
# File lib/qiflib_money.rb, line 20
def to_s
  @string_value
end