Class: ActiveRecord::ConnectionAdapters::SqlTypeMetadata
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::SqlTypeMetadata
- Defined in:
- lib/active_record/connection_adapters/sql_type_metadata.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#precision ⇒ Object
readonly
Returns the value of attribute precision.
-
#scale ⇒ Object
readonly
Returns the value of attribute scale.
-
#sql_type ⇒ Object
readonly
Returns the value of attribute sql_type.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(sql_type: nil, type: nil, limit: nil, precision: nil, scale: nil) ⇒ SqlTypeMetadata
constructor
A new instance of SqlTypeMetadata.
Constructor Details
#initialize(sql_type: nil, type: nil, limit: nil, precision: nil, scale: nil) ⇒ SqlTypeMetadata
Returns a new instance of SqlTypeMetadata.
9 10 11 12 13 14 15 |
# File 'lib/active_record/connection_adapters/sql_type_metadata.rb', line 9 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
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
7 8 9 |
# File 'lib/active_record/connection_adapters/sql_type_metadata.rb', line 7 def limit @limit end |
#precision ⇒ Object (readonly)
Returns the value of attribute precision.
7 8 9 |
# File 'lib/active_record/connection_adapters/sql_type_metadata.rb', line 7 def precision @precision end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale.
7 8 9 |
# File 'lib/active_record/connection_adapters/sql_type_metadata.rb', line 7 def scale @scale end |
#sql_type ⇒ Object (readonly)
Returns the value of attribute sql_type.
7 8 9 |
# File 'lib/active_record/connection_adapters/sql_type_metadata.rb', line 7 def sql_type @sql_type end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/active_record/connection_adapters/sql_type_metadata.rb', line 7 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
17 18 19 20 21 22 23 24 |
# File 'lib/active_record/connection_adapters/sql_type_metadata.rb', line 17 def ==(other) other.is_a?(SqlTypeMetadata) && sql_type == other.sql_type && type == other.type && limit == other.limit && precision == other.precision && scale == other.scale end |
#hash ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/active_record/connection_adapters/sql_type_metadata.rb', line 27 def hash SqlTypeMetadata.hash ^ sql_type.hash ^ type.hash ^ limit.hash ^ precision.hash >> 1 ^ scale.hash >> 2 end |