Class: ActiveRecord::ConnectionAdapters::PostgreSQLTypeMetadata

Inherits:
SqlTypeMetadata show all
Defined in:
activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb

Instance Attribute Summary collapse

Attributes inherited from SqlTypeMetadata

#limit, #precision, #scale, #type

Instance Method Summary collapse

Constructor Details

#initialize(type_metadata, oid: nil, fmod: nil) ⇒ PostgreSQLTypeMetadata

Returns a new instance of PostgreSQLTypeMetadata.


6
7
8
9
10
11
12
# File 'activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 6

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

Instance Attribute Details

#arrayObject (readonly)

Returns the value of attribute array


4
5
6
# File 'activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 4

def array
  @array
end

#fmodObject (readonly)

Returns the value of attribute fmod


4
5
6
# File 'activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 4

def fmod
  @fmod
end

#oidObject (readonly)

Returns the value of attribute oid


4
5
6
# File 'activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 4

def oid
  @oid
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?


18
19
20
21
# File 'activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 18

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

#hashObject


24
25
26
# File 'activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 24

def hash
  attributes_for_hash.hash
end

#sql_typeObject


14
15
16
# File 'activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 14

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