Class: ActiveRecord::ConnectionAdapters::SqlTypeMetadata
- Includes:
- Deduplicable
- Defined in:
- activerecord/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.
Methods included from Deduplicable
Methods included from ActiveSupport::Concern
#append_features, #class_methods, extended, #included
Constructor Details
#initialize(sql_type: nil, type: nil, limit: nil, precision: nil, scale: nil) ⇒ SqlTypeMetadata
Returns a new instance of SqlTypeMetadata.
13 14 15 16 17 18 19 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 13 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
11 12 13 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 11 def limit @limit end |
#precision ⇒ Object (readonly)
Returns the value of attribute precision
11 12 13 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 11 def precision @precision end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale
11 12 13 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 11 def scale @scale end |
#sql_type ⇒ Object (readonly)
Returns the value of attribute sql_type
11 12 13 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 11 def sql_type @sql_type end |
#type ⇒ Object (readonly)
Returns the value of attribute type
11 12 13 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 11 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
21 22 23 24 25 26 27 28 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 21 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
31 32 33 34 35 36 37 38 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 31 def hash SqlTypeMetadata.hash ^ sql_type.hash ^ type.hash ^ limit.hash ^ precision.hash >> 1 ^ scale.hash >> 2 end |