Class: Rails::Sharding::ConnectionHandler::ConnectionPoolOwner
- Inherits:
-
Object
- Object
- Rails::Sharding::ConnectionHandler::ConnectionPoolOwner
- Defined in:
- lib/rails/sharding/connection_handler.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ ConnectionPoolOwner
constructor
A new instance of ConnectionPoolOwner.
-
#superclass ⇒ Object
Safeguard in case pool cannot be retrieved for owner.
-
#to_s ⇒ Object
in case owner ends up printed by rails in an error message when retrieving connection.
Constructor Details
#initialize(name) ⇒ ConnectionPoolOwner
Returns a new instance of ConnectionPoolOwner.
89 90 91 |
# File 'lib/rails/sharding/connection_handler.rb', line 89 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
87 88 89 |
# File 'lib/rails/sharding/connection_handler.rb', line 87 def name @name end |
Instance Method Details
#superclass ⇒ Object
Safeguard in case pool cannot be retrieved for owner. This makes the error clear
94 95 96 |
# File 'lib/rails/sharding/connection_handler.rb', line 94 def superclass raise Errors::ConnectionPoolRetrievalError, "ConnectionPool could not be retrieved for #{self}. See https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb#607" end |
#to_s ⇒ Object
in case owner ends up printed by rails in an error message when retrieving connection
99 100 101 |
# File 'lib/rails/sharding/connection_handler.rb', line 99 def to_s "ConnectionPoolOwner with name #{self.name}" end |