aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/type/hash_lookup_type_map.rb
blob: 828ada00a7c232405939359c8901e83605fbf7be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module ActiveRecord
  module ConnectionAdapters
    module Type
      class HashLookupTypeMap < TypeMap # :nodoc:
        def lookup(type)
          @mapping.fetch(type, proc { default_value }).call(type)
        end

        def alias_type(type, alias_type)
          register_type(type) { lookup(alias_type) }
        end
      end
    end
  end
end