Class: Temporalio::Interceptor::Chain Private
- Inherits:
-
Object
- Object
- Temporalio::Interceptor::Chain
- Defined in:
- lib/temporalio/interceptor/chain.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#initialize(interceptors = []) ⇒ Chain
constructor
private
A new instance of Chain.
- #invoke(method, *input) ⇒ Object private
Constructor Details
#initialize(interceptors = []) ⇒ Chain
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Chain.
5 6 7 |
# File 'lib/temporalio/interceptor/chain.rb', line 5 def initialize(interceptors = []) @interceptors = interceptors end |
Instance Method Details
#invoke(method, *input) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/temporalio/interceptor/chain.rb', line 9 def invoke(method, *input) chain = interceptors.dup traverse_chain = lambda do |*i| if chain.empty? yield(*i) else chain.shift.public_send(method, *i, &traverse_chain) end end traverse_chain.call(*input) end |