Module: Philiprehberger::Money::Formatting
- Included in:
- Philiprehberger::Money
- Defined in:
- lib/philiprehberger/money/formatting.rb
Overview
Formatting methods for Money objects
Instance Method Summary collapse
-
#format(symbol: true, code: false, thousands: true) ⇒ String
Format the money amount as a string.
-
#to_s ⇒ String
Formatted money string (delegates to #format).
Instance Method Details
#format(symbol: true, code: false, thousands: true) ⇒ String
Format the money amount as a string
13 14 15 16 17 18 |
# File 'lib/philiprehberger/money/formatting.rb', line 13 def format(symbol: true, code: false, thousands: true) formatted = format_amount(thousands: thousands) result = build_formatted_string(formatted, symbol: symbol) result = "#{result} #{currency.code.upcase}" if code result end |
#to_s ⇒ String
Returns formatted money string (delegates to #format).
21 22 23 |
# File 'lib/philiprehberger/money/formatting.rb', line 21 def to_s format end |