Class: Kredis::Types::Proxy
- Inherits:
-
Object
- Object
- Kredis::Types::Proxy
- Defined in:
- lib/kredis/types/proxy.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#redis ⇒ Object
Returns the value of attribute redis.
Instance Method Summary collapse
-
#initialize(redis, key, **options) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(method, *args, **kwargs) ⇒ Object
- #multi ⇒ Object
Constructor Details
#initialize(redis, key, **options) ⇒ Proxy
Returns a new instance of Proxy.
4 5 6 7 |
# File 'lib/kredis/types/proxy.rb', line 4 def initialize(redis, key, **) @redis, @key = redis, key .each { |key, value| send("#{key}=", value) } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, **kwargs) ⇒ Object
13 14 15 16 |
# File 'lib/kredis/types/proxy.rb', line 13 def method_missing(method, *args, **kwargs) Kredis.logger&.debug (method, *args, **kwargs) redis.public_send method, key, *args, **kwargs end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
2 3 4 |
# File 'lib/kredis/types/proxy.rb', line 2 def key @key end |
#redis ⇒ Object
Returns the value of attribute redis.
2 3 4 |
# File 'lib/kredis/types/proxy.rb', line 2 def redis @redis end |
Instance Method Details
#multi ⇒ Object
9 10 11 |
# File 'lib/kredis/types/proxy.rb', line 9 def multi(...) redis.multi(...) end |