aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb
blob: 9167593064010860f4d747db34ede1cbc3f7cfed (plain) (tree)
1
2
3
4
5
6
7
8
9

                             



                                                                   

                                                  
                          
 
                                                
                              
                        


                     
                                      

                                             



                     


                             
           



         
# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module MySQL
      class TypeMetadata < DelegateClass(SqlTypeMetadata) # :nodoc:
        undef to_yaml if method_defined?(:to_yaml)

        attr_reader :extra

        def initialize(type_metadata, extra: "")
          super(type_metadata)
          @extra = extra
        end

        def ==(other)
          other.is_a?(TypeMetadata) &&
            __getobj__ == other.__getobj__ &&
            extra == other.extra
        end
        alias eql? ==

        def hash
          TypeMetadata.hash ^
            __getobj__.hash ^
            extra.hash
        end
      end
    end
  end
end