Method: Invoicing::CurrencyValue::ClassInfo#currency_of

Defined in:
lib/invoicing/currency_value.rb

#currency_of(object) ⇒ Object

Returns the value of the currency code column of object, if available; otherwise the default currency code (set by the :currency_code option), if available; nil if all else fails.



254
255
256
257
258
259
260
# File 'lib/invoicing/currency_value.rb', line 254

def currency_of(object)
  if object.attributes.has_key?(method(:currency)) || object.respond_to?(method(:currency))
    get(object, :currency)
  else
    all_options[:currency_code]
  end
end