Class: DatabaseConsistency::Databases::Types::Base
- Inherits:
-
Object
- Object
- DatabaseConsistency::Databases::Types::Base
- Defined in:
- lib/database_consistency/databases/types/base.rb
Overview
Base wrapper for database types
Direct Known Subclasses
Constant Summary collapse
- COVERED_TYPES =
{ 'bigint' => %w[integer bigint], 'integer' => %w[integer smallint] }.freeze
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #convert ⇒ String
- #cover?(other_type) ⇒ Boolean
-
#initialize(type) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(type) ⇒ Base
Returns a new instance of Base.
16 17 18 |
# File 'lib/database_consistency/databases/types/base.rb', line 16 def initialize(type) @type = type.downcase end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/database_consistency/databases/types/base.rb', line 8 def type @type end |
Instance Method Details
#convert ⇒ String
21 22 23 |
# File 'lib/database_consistency/databases/types/base.rb', line 21 def convert type end |
#cover?(other_type) ⇒ Boolean
28 29 30 |
# File 'lib/database_consistency/databases/types/base.rb', line 28 def cover?(other_type) (COVERED_TYPES[convert] || [convert]).include?(other_type.convert) end |