Sha256: bff805d62e0d4349b2b34d01ba5ee05ef257376f27d7eae3564a9b27b5744feb

Contents?: true

Size: 412 Bytes

Versions: 6

Compression:

Stored size: 412 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Extensions #:nodoc:
    module Integer #:nodoc:
      module Conversions #:nodoc:
        def set(value)
          return nil if value.blank?
          begin
            value.to_s =~ /\./ ? Float(value) : Integer(value)
          rescue
            value
          end
        end
        def get(value)
          value
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
mongoid-braxton-2.0.2 lib/mongoid/extensions/integer/conversions.rb
mongoid-2.0.2 lib/mongoid/extensions/integer/conversions.rb
mongoid-2.0.1 lib/mongoid/extensions/integer/conversions.rb
mongoid-2.0.0 lib/mongoid/extensions/integer/conversions.rb
mongoid-2.0.0.rc.8 lib/mongoid/extensions/integer/conversions.rb
mongoid-2.0.0.rc.7 lib/mongoid/extensions/integer/conversions.rb