Class: ActiveRecord::ConnectionAdapters::SqlTypeMetadata

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb

Direct Known Subclasses

MySQL::TypeMetadata, PostgreSQLTypeMetadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sql_type: nil, type: nil, limit: nil, precision: nil, scale: nil) ⇒ SqlTypeMetadata

Returns a new instance of SqlTypeMetadata.


7
8
9
10
11
12
13
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 7

def initialize(sql_type: nil, type: nil, limit: nil, precision: nil, scale: nil)
  @sql_type = sql_type
  @type = type
  @limit = limit
  @precision = precision
  @scale = scale
end

Instance Attribute Details

#limitObject (readonly)

Returns the value of attribute limit


5
6
7
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 5

def limit
  @limit
end

#precisionObject (readonly)

Returns the value of attribute precision


5
6
7
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 5

def precision
  @precision
end

#scaleObject (readonly)

Returns the value of attribute scale


5
6
7
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 5

def scale
  @scale
end

#sql_typeObject (readonly)

Returns the value of attribute sql_type


5
6
7
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 5

def sql_type
  @sql_type
end

#typeObject (readonly)

Returns the value of attribute type


5
6
7
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 5

def type
  @type
end

Instance Method Details

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


15
16
17
18
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 15

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

#hashObject


21
22
23
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 21

def hash
  attributes_for_hash.hash
end