Created
March 12, 2020 02:25
-
-
Save south37/2b1d2dbd9e4ed64529daa55731859c7b to your computer and use it in GitHub Desktop.
.stub_for の実装
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Servicex::Grpc | |
class << self | |
# @example | |
# Servicex::Grpc.stub_for(UsersPb::UserService, UsersApi.base_url) | |
# @param service_class [Class<Grpc::GeneralService>] | |
# @param url [String] | |
# @yield [opts] To modify options for instantiating a Stub | |
# @yieldparam opts [Hash] Default options | |
def stub_for(service_class, url) | |
opts = { | |
channel_args: { | |
'grpc.primary_user_agent' => Servicex.user_agent, | |
}, | |
interceptors: Servicex::Grpc.client_interceptors, | |
} | |
yield opts if block_given? | |
service_class::Stub.new(url, :this_channel_is_insecure, opts) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment