Module: JekyllMoney2::Core

Extended by:
Core
Included in:
Core
Defined in:
lib/jekyll-money2/core.rb

Instance Method Summary collapse

Instance Method Details

#money(value, currency = "USD", options = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/jekyll-money2/core.rb', line 15

def money(value, currency = "USD", options = {})
  @defaults = defaults unless defined?(@defaults)
  @options = @defaults.merge(options)

  value = validate_money!(value, currency)
  format_money(value, currency, options)
end

#money_from_amount(value, currency = 'USD', options = {}) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/jekyll-money2/core.rb', line 23

def money_from_amount(value, currency = 'USD', options = {})
  @defaults = defaults unless defined?(@defaults)
  @options = @defaults.merge(options)

  value = Money.from_amount(value.to_f, currency)
  format_money(value, currency, options)
end