Sha256: 686874d8318d6bddbebf313c0baecc09835ae3e35a040e6fc791fa8a381f3dbd

Contents?: true

Size: 849 Bytes

Versions: 19

Compression:

Stored size: 849 Bytes

Contents

module ActiveRecord
  module ConnectionAdapters
    class PostgreSQLTypeMetadata < DelegateClass(SqlTypeMetadata)
      undef to_yaml if method_defined?(:to_yaml)

      attr_reader :oid, :fmod, :array

      def initialize(type_metadata, oid: nil, fmod: nil)
        super(type_metadata)
        @type_metadata = type_metadata
        @oid = oid
        @fmod = fmod
        @array = /\[\]$/.match?(type_metadata.sql_type)
      end

      def sql_type
        super.gsub(/\[\]$/, "".freeze)
      end

      def ==(other)
        other.is_a?(PostgreSQLTypeMetadata) &&
          attributes_for_hash == other.attributes_for_hash
      end
      alias eql? ==

      def hash
        attributes_for_hash.hash
      end

      protected

        def attributes_for_hash
          [self.class, @type_metadata, oid, fmod]
        end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
activerecord-5.1.7 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.7.rc1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.6.2 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.6.1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.6 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.5 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.5.rc1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.4 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.4.rc1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.3 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.3.rc3 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.3.rc2 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.3.rc1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.2 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.2.rc1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.0 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.0.rc2 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.1.0.rc1 lib/active_record/connection_adapters/postgresql/type_metadata.rb