Class: ConvenientService::Common::Plugins::HasCallbacks::Middleware
- Inherits:
-
MethodChainMiddleware
- Object
- ConvenientService::Common::Plugins::HasCallbacks::Middleware
- Defined in:
- lib/convenient_service/common/plugins/has_callbacks/middleware.rb
Instance Method Summary collapse
- #any_method ⇒ Object
-
#next(*args, **kwargs, &block) ⇒ Object
Can be any type.
Instance Method Details
#any_method ⇒ Object
12 |
# File 'lib/convenient_service/common/plugins/has_callbacks/middleware.rb', line 12 intended_for any_method, entity: any_entity |
#next(*args, **kwargs, &block) ⇒ Object
Returns Can be any type.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/convenient_service/common/plugins/has_callbacks/middleware.rb', line 23 def next(*args, **kwargs, &block) ## # class Service # before :result do # end # # before :result do |arguments| # end # end # 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 # callbacks.for([:after, method]).reverse_each { |callback| callback.call_in_context_with_value_and_arguments(entity, original_value, *args, **kwargs, &block) } original_value end |