Sha256: 2efd9333902ff898deb94faf5785c42d59a3874380c27fd98617608266ac3e7d

Contents?: true

Size: 789 Bytes

Versions: 35

Compression:

Stored size: 789 Bytes

Contents

module ActiveRecord
  module ConnectionAdapters
    class PostgreSQLTypeMetadata < DelegateClass(SqlTypeMetadata)
      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 = /\[\]$/ === 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

35 entries across 35 versions & 4 rubygems

Version Path
activerecord-5.0.7.2 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.7.1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.7 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.6 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.6.rc1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.5 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.5.rc2 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.5.rc1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.4 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.4.rc1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.3 lib/active_record/connection_adapters/postgresql/type_metadata.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.2 lib/active_record/connection_adapters/postgresql/type_metadata.rb
activerecord-5.0.2.rc1 lib/active_record/connection_adapters/postgresql/type_metadata.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/type_metadata.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/type_metadata.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/type_metadata.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/type_metadata.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/type_metadata.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/type_metadata.rb