Sha256: bc9ac9bb4d5acf6e9178538fa1d47e47efb1580791257e2495d48bc628e57f67

Contents?: true

Size: 459 Bytes

Versions: 3

Compression:

Stored size: 459 Bytes

Contents

module StrictMoney
  module Orms
    module Mongoid
      # Extend StrictMoney::Amount to work with Mongoid.
      module Amount
        def mongoize
          {'currency' => @currency, 'amount' => @amount}
        end

        def self.included(base)
          def base.demongoize(object)
            StrictMoney.demongoize_amount(object)
          end
        end
      end
    end
  end
end

StrictMoney::Amount.include(StrictMoney::Orms::Mongoid::Amount)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
strict_money-0.4.0 lib/strict_money/orms/mongoid/amount.rb
strict_money-0.3.0 lib/strict_money/orms/mongoid/amount.rb
strict_money-0.2.0 lib/strict_money/orms/mongoid/amount.rb