Module: Temporalio::Interceptor

Defined in:
lib/temporalio/interceptor.rb,
lib/temporalio/interceptor/chain.rb,
lib/temporalio/interceptor/client.rb,
lib/temporalio/interceptor/activity_inbound.rb,
lib/temporalio/interceptor/activity_outbound.rb

Defined Under Namespace

Modules: ActivityInbound, ActivityOutbound, Client Classes: Chain

Class Method Summary collapse

Class Method Details

.filter(interceptors, type) ⇒ Object

NOTE: Using #each_with_object here and below instead of a simple #select because RBS can’t

reconcile that resulting array only has WorkflowInbound or WorkflowOutbound in it.


8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/temporalio/interceptor.rb', line 8

def self.filter(interceptors, type)
  interceptor_class =
    case type
    when :activity_inbound
      Temporalio::Interceptor::ActivityInbound
    when :activity_outbound
      Temporalio::Interceptor::ActivityOutbound
    end

  interceptors.each_with_object([]) do |i, result|
    result << i if i.is_a?(interceptor_class)
  end
end