Sha256: ea61436a06ac9254d8e985c38ccacb3f47cabd0474cd12d0ebb111c7841df6e7

Contents?: true

Size: 1.09 KB

Versions: 17

Compression:

Stored size: 1.09 KB

Contents

require 'set'

require 'mongomodel/support/types/object'
require 'mongomodel/support/types/string'
require 'mongomodel/support/types/integer'
require 'mongomodel/support/types/float'
require 'mongomodel/support/types/boolean'
require 'mongomodel/support/types/symbol'
require 'mongomodel/support/types/date'
require 'mongomodel/support/types/time'
require 'mongomodel/support/types/custom'
require 'mongomodel/support/types/array'
require 'mongomodel/support/types/set'
require 'mongomodel/support/types/hash'

module MongoModel
  module Types
    CONVERTERS = {
      ::String  => Types::String.new,
      ::Integer => Types::Integer.new,
      ::Float   => Types::Float.new,
      ::Boolean => Types::Boolean.new,
      ::Symbol  => Types::Symbol.new,
      ::Date    => Types::Date.new,
      ::Time    => Types::Time.new,
      ::Array   => Types::Array.new,
      ::Set     => Types::Set.new,
      ::Hash    => Types::Hash.new
    }
    
    def self.converter_for(type)
      if CONVERTERS[type]
        CONVERTERS[type]
      else
        CONVERTERS[type] = Types::Custom.new(type)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mongomodel-0.2.20 lib/mongomodel/support/types.rb
mongomodel-0.2.19 lib/mongomodel/support/types.rb
mongomodel-0.2.18 lib/mongomodel/support/types.rb
mongomodel-0.2.17 lib/mongomodel/support/types.rb
mongomodel-0.2.16 lib/mongomodel/support/types.rb
mongomodel-0.2.15 lib/mongomodel/support/types.rb
mongomodel-0.2.14 lib/mongomodel/support/types.rb
mongomodel-0.2.13 lib/mongomodel/support/types.rb
mongomodel-0.2.12 lib/mongomodel/support/types.rb
mongomodel-0.2.11 lib/mongomodel/support/types.rb
mongomodel-0.2.10 lib/mongomodel/support/types.rb
mongomodel-0.2.9 lib/mongomodel/support/types.rb
mongomodel-0.2.8 lib/mongomodel/support/types.rb
mongomodel-0.2.7 lib/mongomodel/support/types.rb
mongomodel-0.2.6 lib/mongomodel/support/types.rb
mongomodel-0.2.5 lib/mongomodel/support/types.rb
mongomodel-0.2.4 lib/mongomodel/support/types.rb