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, #prepend_features, #prepended
Constructor Details
#initialize(sql_type: nil, type: nil, limit: nil, precision: nil, scale: nil) ⇒ SqlTypeMetadata
Returns a new instance of SqlTypeMetadata.
11 12 13 14 15 16 17 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 11 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
9 10 11 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 9 def limit @limit end |
#precision ⇒ Object (readonly)
Returns the value of attribute precision
9 10 11 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 9 def precision @precision end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale
9 10 11 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 9 def scale @scale end |
#sql_type ⇒ Object (readonly)
Returns the value of attribute sql_type
9 10 11 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 9 def sql_type @sql_type end |
#type ⇒ Object (readonly)
Returns the value of attribute type
9 10 11 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 9 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
19 20 21 22 23 24 25 26 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 19 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
29 30 31 32 33 34 35 36 |
# File 'activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb', line 29 def hash SqlTypeMetadata.hash ^ sql_type.hash ^ type.hash ^ limit.hash ^ precision.hash >> 1 ^ scale.hash >> 2 end |