Class: AbstractFeatureBranch::Redis::ConnectionPoolToRedisAdapter
- Defined in:
- lib/abstract_feature_branch/redis/connection_pool_to_redis_adapter.rb
Overview
Adapts a ConnectionPool instance to the Redis object interface
Instance Attribute Summary collapse
-
#connection_pool ⇒ Object
readonly
Returns the value of attribute connection_pool.
Instance Method Summary collapse
-
#initialize(connection_pool) ⇒ ConnectionPoolToRedisAdapter
constructor
A new instance of ConnectionPoolToRedisAdapter.
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to?(method_name, include_private = false, &block) ⇒ Boolean
Constructor Details
#initialize(connection_pool) ⇒ ConnectionPoolToRedisAdapter
Returns a new instance of ConnectionPoolToRedisAdapter.
7 8 9 |
# File 'lib/abstract_feature_branch/redis/connection_pool_to_redis_adapter.rb', line 7 def initialize(connection_pool) @connection_pool = connection_pool end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/abstract_feature_branch/redis/connection_pool_to_redis_adapter.rb', line 19 def method_missing(method_name, *args, &block) connection_can_respond_to = nil result = nil @connection_pool.with do |connection| connection_can_respond_to = connection.respond_to?(method_name, true) result = connection.send(method_name, *args, &block) if connection_can_respond_to end if connection_can_respond_to result else super end end |
Instance Attribute Details
#connection_pool ⇒ Object (readonly)
Returns the value of attribute connection_pool.
5 6 7 |
# File 'lib/abstract_feature_branch/redis/connection_pool_to_redis_adapter.rb', line 5 def connection_pool @connection_pool end |
Instance Method Details
#respond_to?(method_name, include_private = false, &block) ⇒ Boolean
11 12 13 14 15 16 17 |
# File 'lib/abstract_feature_branch/redis/connection_pool_to_redis_adapter.rb', line 11 def respond_to?(method_name, include_private = false, &block) result = false @connection_pool.with do |connection| result ||= connection.respond_to?(method_name, include_private, &block) end result || super end |