Sha256: 487c0c2f5eb786f7da7614910e2b01536a3ff6ad8d48b52d866f26a9f76fe82b
Contents?: true
Size: 1.31 KB
Versions: 5
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true module ConvenientService module Common module Plugins module HasCallbacks class Middleware < MethodChainMiddleware intended_for any_method, scope: any_scope, entity: any_entity ## # @internal # TODO: Move to command. # def next(*args, **kwargs, &block) ## # class Service # before :result do # end # # before :result do |arguments| # end # end # entity.callbacks.for([:before, method]).each { |callback| callback.call_in_context_with_arguments(entity, *args, **kwargs, &block) } original_value = chain.next(*args, **kwargs, &block) ## # class Service # after :result do # end # # after :result do |result| # end # # after :result do |result, arguments| # end # end # entity.callbacks.for([:after, method]).reverse_each { |callback| callback.call_in_context_with_value_and_arguments(entity, original_value, *args, **kwargs, &block) } original_value end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems