Module: Mongoid::Extensions::BigDecimal::Conversions

Included in:
BigDecimal
Defined in:
lib/mongoid/extensions/big_decimal/conversions.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#get(value) ⇒ Object

Get the string as a BigDecimal



9
10
11
# File 'lib/mongoid/extensions/big_decimal/conversions.rb', line 9

def get(value)
  value ? ::BigDecimal.new(value) : value
end

#set(value) ⇒ Object

Set the value in the hash as a string.



13
14
15
# File 'lib/mongoid/extensions/big_decimal/conversions.rb', line 13

def set(value)
  value ? value.to_s : value
end