Class: ActiveRecord::ConnectionAdapters::PostgreSQL::Column

Inherits:
Column
  • Object
show all
Defined in:
lib/active_record/connection_adapters/postgresql/column.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Column

#collation, #comment, #default, #default_function, #name, #null, #sql_type_metadata

Instance Method Summary collapse

Methods inherited from Column

#==, #bigint?, #encode_with, #has_default?, #hash, #human_name, #init_with

Constructor Details

#initialize(serial: nil) ⇒ Column

Returns a new instance of Column.



9
10
11
12
# File 'lib/active_record/connection_adapters/postgresql/column.rb', line 9

def initialize(*, serial: nil, **)
  super
  @serial = serial
end

Instance Method Details

#arrayObject Also known as: array?



18
19
20
# File 'lib/active_record/connection_adapters/postgresql/column.rb', line 18

def array
  .sql_type.end_with?("[]")
end

#serial?Boolean

Returns:

  • (Boolean)


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

def serial?
  @serial
end

#sql_typeObject



23
24
25
# File 'lib/active_record/connection_adapters/postgresql/column.rb', line 23

def sql_type
  super.sub(/\[\]\z/, "")
end