Sha256: 09140a62223b0394bbc8adb8489687b8b43fb6204138c8117d9f56ea305503c1

Contents?: true

Size: 559 Bytes

Versions: 2

Compression:

Stored size: 559 Bytes

Contents

module StrictMoney
  module Orms
    module Mongoid
      # Extend StrictMoney::Configuration to work with Mongoid.
      module Configuration
        def demongoize_amount(object = nil, &block)
          if block
            @demongoize_block = block
          elsif @demongoize_block
            @demongoize_block.call(object)
          elsif object
            StrictMoney::Amount.new(object['amount'], object['currency'])
          end
        end
      end
    end
  end
end

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

Version data entries

2 entries across 2 versions & 1 rubygems

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