class CamtParser::Misc

Public Class Methods

to_amount(value) click to toggle source
# File lib/camt_parser/misc.rb, line 10
def to_amount(value)
  return nil if value == nil || value.strip == ''

  BigDecimal(value.gsub(',', '.'))
end
to_amount_in_cents(value) click to toggle source
# File lib/camt_parser/misc.rb, line 4
def to_amount_in_cents(value)
  return nil if value == nil || value.strip == ''

  value.gsub(/[,|\.](\d*)/) { $1.ljust(2, '0') }.to_i
end