Sha256: 06967b088d4b2419899f70aececad38e6266e0d35483cbf6c4245d63a5accae3

Contents?: true

Size: 435 Bytes

Versions: 38

Compression:

Stored size: 435 Bytes

Contents

# encoding: utf-8
require "bigdecimal"

module Mongoid #:nodoc:
  module Extensions #:nodoc:
    module BigDecimal #:nodoc:
      module Conversions #:nodoc:
        # Get the string as a +BigDecimal+
        def get(value)
          value ? ::BigDecimal.new(value) : value
        end
        # Set the value in the hash as a string.
        def set(value)
          value ? value.to_s : value
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 8 rubygems

Version Path
mongoid-braxton-2.0.2 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.2 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.1 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0.rc.8 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-1.9.5 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0.rc.7 lib/mongoid/extensions/big_decimal/conversions.rb
stonegao-mongoid-2.0.0.rc.6 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0.rc.6 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0.rc.5 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0.rc.4 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0.rc.3 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0.rc.2 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0.rc.1 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-with-auth-1.9.4 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-rails2-1.9.4 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-rails2-1.9.3 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0.beta.20 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-2.0.0.beta.19 lib/mongoid/extensions/big_decimal/conversions.rb
mongoid-1.9.2 lib/mongoid/extensions/big_decimal/conversions.rb