Class: Money

Inherits:
Object
  • Object
show all
Defined in:
lib/ascii_invoicer/mixins.rb

Instance Method Summary collapse

Instance Method Details

#to_euroObject



29
30
31
# File 'lib/ascii_invoicer/mixins.rb', line 29

def to_euro
  self
end

#to_sObject



22
23
24
25
26
27
# File 'lib/ascii_invoicer/mixins.rb', line 22

def to_s
  value = self.amount
  a,b = sprintf("%0.2f", value.to_s).split('.')
  a.gsub!(/(\d)(?=(\d{3})+(?!\d))/, '\\1.')
  "#{a}#{self.currency.separator}#{b}#{self.currency.symbol}"
end