Skip to content

Commit

Permalink
Fix rubocop errors due to Rubocop 0.51.0 -> 0.53.0 bump
Browse files Browse the repository at this point in the history
  • Loading branch information
splittingred committed Mar 14, 2018
1 parent b3cf812 commit ea8ef03
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
# SupportedStyles: keyword, variable, start_of_line
Lint/EndAlignment:
Layout/EndAlignment:
Enabled: false

Lint/AmbiguousOperator:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ group :development, :test do
gem 'factory_bot'
gem 'ffaker'
gem 'pry-byebug'
gem 'rubocop', '~> 0.51'
gem 'rubocop', '~> 0.53.0'
end

group :test do
Expand Down
6 changes: 3 additions & 3 deletions lib/gruf/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ def streaming_request?(request_method)
#
# @param [Symbol] call_sig The call signature being executed
# @param [Object] req (Optional) The protobuf request message to send
# @param [Hash] md (Optional) A hash of metadata key/values that are transported with the client request
# @param [Hash] metadata (Optional) A hash of metadata key/values that are transported with the client request
# @param [Hash] opts (Optional) A hash of options to send to the gRPC request_response method
#
def execute(call_sig, req, md, opts = {}, &block)
def execute(call_sig, req, metadata, opts = {}, &block)
Timer.time do
opts[:return_op] = true
opts[:metadata] = md
opts[:metadata] = metadata
send(call_sig, req, opts, &block)
end
end
Expand Down
5 changes: 3 additions & 2 deletions lib/gruf/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ def set_debug_info(detail, stack_trace = [])
##
# Ensure all metadata values are strings as HTTP/2 requires string values for transport
#
# @param [Hash] metadata The existing metadata hash
# @return [Hash] The newly set metadata
#
def metadata=(md)
@metadata = md.map { |k, str| [k, str.to_s] }.to_h
def metadata=(metadata)
@metadata = metadata.map { |k, str| [k, str.to_s] }.to_h
end

##
Expand Down
18 changes: 9 additions & 9 deletions lib/gruf/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ class Response
##
# Initialize a response object with the given gRPC operation
#
# @param [GRPC::ActiveCall::Operation] op The given operation for the current call
# @param [GRPC::ActiveCall::Operation] operation The given operation for the current call
# @param [Float] execution_time The amount of time that the response took to occur
#
def initialize(op, execution_time = nil)
@operation = op
@message = op.execute
@metadata = op.metadata
@trailing_metadata = op.trailing_metadata
@deadline = op.deadline
@cancelled = op.cancelled?
def initialize(operation, execution_time = nil)
@operation = operation
@message = operation.execute
@metadata = operation.metadata
@trailing_metadata = operation.trailing_metadata
@deadline = operation.deadline
@cancelled = operation.cancelled?
@execution_time = execution_time || 0.0
end

Expand All @@ -53,7 +53,7 @@ def initialize(op, execution_time = nil)
# @return [Object] The protobuf response message
#
def message
@message ||= op.execute
@message ||= @operation.execute
end

##
Expand Down

0 comments on commit ea8ef03

Please sign in to comment.