Class: Simple::Sharding::ConnectionHandler::ConnectionPoolOwner
- Inherits:
-
Object
- Object
- Simple::Sharding::ConnectionHandler::ConnectionPoolOwner
- Defined in:
- lib/simple/sharding/connection_handler.rb
Overview
Connection pool need a class to own each connection
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.
55 56 57 |
# File 'lib/simple/sharding/connection_handler.rb', line 55 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
53 54 55 |
# File 'lib/simple/sharding/connection_handler.rb', line 53 def name @name end |
Instance Method Details
#superclass ⇒ Object
Safeguard in case pool cannot be retrieved for owner. This makes the error clear
60 61 62 |
# File 'lib/simple/sharding/connection_handler.rb', line 60 def superclass raise Exception, "ConnectionPool could not be retrieved for #{self}. " end |
#to_s ⇒ Object
in case owner ends up printed by rails in an error message when retrieving connection
65 66 67 |
# File 'lib/simple/sharding/connection_handler.rb', line 65 def to_s "ConnectionPoolOwner with name #{self.name}" end |