Class: CamtParser::Misc

Inherits:
Object
  • Object
show all
Defined in:
lib/camt_parser/misc.rb

Class Method Summary collapse

Class Method Details

.to_amount(value) ⇒ Object



8
9
10
# File 'lib/camt_parser/misc.rb', line 8

def to_amount(value)
  BigDecimal.new value.gsub(',', '.')
end

.to_amount_in_cents(value) ⇒ Object



4
5
6
# File 'lib/camt_parser/misc.rb', line 4

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