Class: Kredis::Types::CallbacksProxy
- Inherits:
-
Object
- Object
- Kredis::Types::CallbacksProxy
- Defined in:
- lib/kredis/types/callbacks_proxy.rb
Constant Summary collapse
- AFTER_CHANGE_OPERATIONS =
{ Kredis::Types::Counter => %i[ increment decrement reset ], Kredis::Types::Cycle => %i[ next ], Kredis::Types::Enum => %i[ value= reset ], Kredis::Types::Flag => %i[ mark remove ], Kredis::Types::Hash => %i[ update delete ], Kredis::Types::List => %i[ remove prepend append << ], Kredis::Types::Scalar => %i[ value= clear ], Kredis::Types::Set => %i[ add << remove replace take clear ], Kredis::Types::Slots => %i[ reserve release reset ] }
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, callback) ⇒ CallbacksProxy
constructor
A new instance of CallbacksProxy.
- #method_missing(method, *args, **kwargs, &block) ⇒ Object
Constructor Details
#initialize(type, callback) ⇒ CallbacksProxy
Returns a new instance of CallbacksProxy.
17 18 19 |
# File 'lib/kredis/types/callbacks_proxy.rb', line 17 def initialize(type, callback) @type, @callback = type, callback end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, **kwargs, &block) ⇒ Object
21 22 23 24 25 |
# File 'lib/kredis/types/callbacks_proxy.rb', line 21 def method_missing(method, *args, **kwargs, &block) result = type.send(method, *args, **kwargs, &block) invoke_suitable_after_change_callback_for method result end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
2 3 4 |
# File 'lib/kredis/types/callbacks_proxy.rb', line 2 def type @type end |