Sha256: 01b7ed40c8da874cc91d33b968cda057bed2152cf6033eb246182b6497c4a734

Contents?: true

Size: 486 Bytes

Versions: 51

Compression:

Stored size: 486 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module Type
    class HashLookupTypeMap < TypeMap # :nodoc:
      def alias_type(type, alias_type)
        register_type(type) { |_, *args| lookup(alias_type, *args) }
      end

      def key?(key)
        @mapping.key?(key)
      end

      def keys
        @mapping.keys
      end

      private

        def perform_fetch(type, *args, &block)
          @mapping.fetch(type, block).call(type, *args)
        end
    end
  end
end

Version data entries

51 entries across 51 versions & 7 rubygems

Version Path
activerecord-6.0.2.rc2 lib/active_record/type/hash_lookup_type_map.rb
activerecord-5.2.4 lib/active_record/type/hash_lookup_type_map.rb
activerecord-6.0.2.rc1 lib/active_record/type/hash_lookup_type_map.rb
activerecord-5.2.4.rc1 lib/active_record/type/hash_lookup_type_map.rb
activerecord-6.0.1 lib/active_record/type/hash_lookup_type_map.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activerecord-6.0.0/lib/active_record/type/hash_lookup_type_map.rb
activerecord-6.0.1.rc1 lib/active_record/type/hash_lookup_type_map.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activerecord-6.0.0/lib/active_record/type/hash_lookup_type_map.rb
activerecord-6.0.0 lib/active_record/type/hash_lookup_type_map.rb
spiral_form-0.1.1 vendor/bundle/gems/activerecord-5.2.3/lib/active_record/type/hash_lookup_type_map.rb
spiral_form-0.1.0 vendor/bundle/gems/activerecord-5.2.3/lib/active_record/type/hash_lookup_type_map.rb
activerecord-6.0.0.rc2 lib/active_record/type/hash_lookup_type_map.rb
activerecord-6.0.0.rc1 lib/active_record/type/hash_lookup_type_map.rb
activerecord-5.2.3 lib/active_record/type/hash_lookup_type_map.rb
activerecord-5.2.3.rc1 lib/active_record/type/hash_lookup_type_map.rb
activerecord-6.0.0.beta3 lib/active_record/type/hash_lookup_type_map.rb
activerecord-5.2.2.1 lib/active_record/type/hash_lookup_type_map.rb
activerecord-6.0.0.beta2 lib/active_record/type/hash_lookup_type_map.rb
activerecord-6.0.0.beta1 lib/active_record/type/hash_lookup_type_map.rb
nullifyable-0.1.0 vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/hash_lookup_type_map.rb