Class: Io::FlowCommerce::Reference::V0::Models::Currency

Inherits:
Object
  • Object
show all
Defined in:
lib/flowcommerce-reference.rb

Instance Method Summary collapse

Instance Method Details

#to_cents(amount_in) ⇒ Object



104
105
106
107
108
109
110
111
112
# File 'lib/flowcommerce-reference.rb', line 104

def to_cents(amount_in)
  amount = amount_in.to_f

  if number_decimals > 0
    (amount * (10**number_decimals)).round(0)
  else
    amount.to_i
  end
end