Module: StrictMoney::Orms::Mongoid::Configuration

Included in:
Configuration
Defined in:
lib/strict_money/orms/mongoid/configuration.rb

Overview

Extend StrictMoney::Configuration to work with Mongoid.

Instance Method Summary collapse

Instance Method Details

#demongoize_amount(object = nil, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/strict_money/orms/mongoid/configuration.rb', line 6

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