class Kredis::Types::CallbacksProxy

Constants

AFTER_CHANGE_OPERATIONS

Attributes

type[R]

Public Class Methods

new(type, callback) click to toggle source
# File lib/kredis/types/callbacks_proxy.rb, line 17
def initialize(type, callback)
  @type, @callback = type, callback
end

Public Instance Methods

method_missing(method, *args, **kwargs, &block) click to toggle source
# 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

Private Instance Methods

invoke_suitable_after_change_callback_for(method) click to toggle source
# File lib/kredis/types/callbacks_proxy.rb, line 28
def invoke_suitable_after_change_callback_for(method)
  @callback.call(type) if AFTER_CHANGE_OPERATIONS[type.class]&.include? method
end