Class: Sidekiq::Hierarchy::RedisConnection::ConnectionProxy
- Inherits:
-
Object
- Object
- Sidekiq::Hierarchy::RedisConnection::ConnectionProxy
- Defined in:
- lib/sidekiq/hierarchy/redis_connection.rb
Overview
A translation class turning a Redis object into a ConnectionPool-alike
Instance Attribute Summary collapse
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
Instance Method Summary collapse
-
#initialize(redis_conn) ⇒ ConnectionProxy
constructor
A new instance of ConnectionProxy.
- #with(&blk) ⇒ Object
Constructor Details
#initialize(redis_conn) ⇒ ConnectionProxy
Returns a new instance of ConnectionProxy.
8 9 10 11 |
# File 'lib/sidekiq/hierarchy/redis_connection.rb', line 8 def initialize(redis_conn) raise 'connection must be an instance of Redis' unless redis_conn.is_a?(::Redis) @redis = redis_conn end |
Instance Attribute Details
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
6 7 8 |
# File 'lib/sidekiq/hierarchy/redis_connection.rb', line 6 def redis @redis end |
Instance Method Details
#with(&blk) ⇒ Object
13 14 15 |
# File 'lib/sidekiq/hierarchy/redis_connection.rb', line 13 def with(&blk) blk.call(redis) end |