Covert hash to keyword arguments for ruby 2.7

Ruby 2.7 deprecated passing a hash as the last argument for a method that takes keyword params. This commit coverts the hash explicitly to keyword args using the double splat.


```
grpc-1.28.0-universal-darwin/src/ruby/lib/grpc/generic/service.rb:170: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
```
pull/22915/head
Jason Meller 5 years ago committed by GitHub
parent f7591a3426
commit 3e17411774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/ruby/lib/grpc/generic/service.rb

@ -167,22 +167,22 @@ module GRPC
if desc.request_response?
define_method(mth_name) do |req, metadata = {}|
GRPC.logger.debug("calling #{@host}:#{route}")
request_response(route, req, marshal, unmarshal, metadata)
request_response(route, req, marshal, unmarshal, **metadata)
end
elsif desc.client_streamer?
define_method(mth_name) do |reqs, metadata = {}|
GRPC.logger.debug("calling #{@host}:#{route}")
client_streamer(route, reqs, marshal, unmarshal, metadata)
client_streamer(route, reqs, marshal, unmarshal, **metadata)
end
elsif desc.server_streamer?
define_method(mth_name) do |req, metadata = {}, &blk|
GRPC.logger.debug("calling #{@host}:#{route}")
server_streamer(route, req, marshal, unmarshal, metadata, &blk)
server_streamer(route, req, marshal, unmarshal, **metadata, &blk)
end
else # is a bidi_stream
define_method(mth_name) do |reqs, metadata = {}, &blk|
GRPC.logger.debug("calling #{@host}:#{route}")
bidi_streamer(route, reqs, marshal, unmarshal, metadata, &blk)
bidi_streamer(route, reqs, marshal, unmarshal, **metadata, &blk)
end
end
end

Loading…
Cancel
Save