Sha256: 139360416309544240bb3627f801ac5c31420ead5b5ba17e8ee7149726ba6307

Contents?: true

Size: 590 Bytes

Versions: 5

Compression:

Stored size: 590 Bytes

Contents

class MicroMoney < Money

  # Forces the :units => :millicents option.
  def initialize_with_millicents(money, *args)
    options = args.last.is_a?(Hash) ? args.pop : {}
    options.merge!(:units => :millicents)
    initialize_without_millicents(money, *(args << options))
  end

  alias :initialize_without_millicents :initialize
  alias :initialize :initialize_with_millicents


  ### OUTPUT/CONVERSIONS

  # Conversion to MicroMoney.
  def to_micro_money
    self
  end

  # Conversion to Money.
  def to_money
    Money.new(millicents, currency, bank, :units => :millicents)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sevenwire-money-2.2.0 lib/money/micro_money.rb
sevenwire-money-2.3.0 lib/money/micro_money.rb
sevenwire-money-2.3.1 lib/money/micro_money.rb
sevenwire-money-2.3.2 lib/money/micro_money.rb
sevenwire-money-2.3.3 lib/money/micro_money.rb