Class: ActiveRecord::ConnectionAdapters::PostgreSQLTypeMetadata
- Inherits:
-
SqlTypeMetadata
- Object
- SqlTypeMetadata
- ActiveRecord::ConnectionAdapters::PostgreSQLTypeMetadata
- Defined in:
- lib/active_record/connection_adapters/postgresql/type_metadata.rb
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
-
#fmod ⇒ Object
readonly
Returns the value of attribute fmod.
-
#oid ⇒ Object
readonly
Returns the value of attribute oid.
Attributes inherited from SqlTypeMetadata
#limit, #precision, #scale, #type
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(type_metadata, oid: nil, fmod: nil) ⇒ PostgreSQLTypeMetadata
constructor
A new instance of PostgreSQLTypeMetadata.
- #sql_type ⇒ Object
Constructor Details
#initialize(type_metadata, oid: nil, fmod: nil) ⇒ PostgreSQLTypeMetadata
Returns a new instance of PostgreSQLTypeMetadata.
10 11 12 13 14 15 16 |
# File 'lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 10 def initialize(, oid: nil, fmod: nil) super() @type_metadata = @oid = oid @fmod = fmod @array = /\[\]$/.match?(.sql_type) end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
8 9 10 |
# File 'lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 8 def array @array end |
#fmod ⇒ Object (readonly)
Returns the value of attribute fmod.
8 9 10 |
# File 'lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 8 def fmod @fmod end |
#oid ⇒ Object (readonly)
Returns the value of attribute oid.
8 9 10 |
# File 'lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 8 def oid @oid end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
22 23 24 25 |
# File 'lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 22 def ==(other) other.is_a?(PostgreSQLTypeMetadata) && attributes_for_hash == other.attributes_for_hash end |
#hash ⇒ Object
28 29 30 |
# File 'lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 28 def hash attributes_for_hash.hash end |
#sql_type ⇒ Object
18 19 20 |
# File 'lib/active_record/connection_adapters/postgresql/type_metadata.rb', line 18 def sql_type super.gsub(/\[\]$/, "".freeze) end |