Module: GRPC::Core::ChannelCredentialsComposable Private

Included in:
ChannelCredentials, XdsChannelCredentials
Defined in:
src/ruby/lib/grpc/core/channel_credentials.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Provides shared #compose logic for channel credential classes.

Instance Method Summary collapse

Instance Method Details

#compose(*others) ⇒ 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.



22
23
24
25
26
27
28
29
30
31
32
33
# File 'src/ruby/lib/grpc/core/channel_credentials.rb', line 22

def compose(*others)
  return self if others.empty?
  flat_others = others.flatten

  flat_others.each do |o|
    fail TypeError, "Argument to compose must be a CallCredentials, got #{o.class}" \
      unless o.is_a?(CallCredentials)
  end

  call_creds = flat_others.size == 1 ? flat_others.first : CompositeCallCredentials.new(flat_others)
  CompositeChannelCredentials.new(self, call_creds)
end