Class: ActiveRecord::ConnectionAdapters::SQLite3::Column
- Inherits:
-
Column
- Object
- Column
- ActiveRecord::ConnectionAdapters::SQLite3::Column
show all
- Defined in:
- lib/active_record/connection_adapters/sqlite3/column.rb
Overview
Instance Attribute Summary collapse
Attributes inherited from Column
#collation, #comment, #default, #default_function, #name, #null, #sql_type_metadata
Instance Method Summary
collapse
Methods inherited from Column
#auto_populated?, #bigint?, #has_default?, #human_name, #virtual?
#deduplicate
Constructor Details
#initialize(auto_increment: nil, rowid: false) ⇒ Column
Returns a new instance of Column.
9
10
11
12
13
|
# File 'lib/active_record/connection_adapters/sqlite3/column.rb', line 9
def initialize(*, auto_increment: nil, rowid: false, **)
super
@auto_increment = auto_increment
@rowid = rowid
end
|
Instance Attribute Details
#rowid ⇒ Object
Returns the value of attribute rowid.
7
8
9
|
# File 'lib/active_record/connection_adapters/sqlite3/column.rb', line 7
def rowid
@rowid
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
33
34
35
36
37
|
# File 'lib/active_record/connection_adapters/sqlite3/column.rb', line 33
def ==(other)
other.is_a?(Column) &&
super &&
auto_increment? == other.auto_increment?
end
|
#auto_increment? ⇒ Boolean
15
16
17
|
# File 'lib/active_record/connection_adapters/sqlite3/column.rb', line 15
def auto_increment?
@auto_increment
end
|
#auto_incremented_by_db? ⇒ Boolean
19
20
21
|
# File 'lib/active_record/connection_adapters/sqlite3/column.rb', line 19
def auto_incremented_by_db?
auto_increment? || rowid
end
|
#encode_with(coder) ⇒ Object
28
29
30
31
|
# File 'lib/active_record/connection_adapters/sqlite3/column.rb', line 28
def encode_with(coder)
coder["auto_increment"] = @auto_increment
super
end
|
#hash ⇒ Object
40
41
42
43
44
45
|
# File 'lib/active_record/connection_adapters/sqlite3/column.rb', line 40
def hash
Column.hash ^
super.hash ^
auto_increment?.hash ^
rowid.hash
end
|
#init_with(coder) ⇒ Object
23
24
25
26
|
# File 'lib/active_record/connection_adapters/sqlite3/column.rb', line 23
def init_with(coder)
@auto_increment = coder["auto_increment"]
super
end
|