Method: Invoicing::CurrencyValue::ClassInfo#attr_conversion_input

Defined in:
lib/invoicing/currency_value.rb

#attr_conversion_input(object, attr) ⇒ Object

If other modules have registered callbacks for the event of reading a rounded attribute, they are executed here. attr is the name of the attribute being read.



280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/invoicing/currency_value.rb', line 280

def attr_conversion_input(object, attr)
  value = nil

  if callback = all_options[:conversion_input]
    value = object.send(callback, attr)
  end

  unless value
    raw_value = object.read_attribute(attr)
    value = BigDecimal.new(raw_value.to_s) unless raw_value.nil?
  end
  value
end