diff options
author | Tim Emiola <tbetbetbe@users.noreply.github.com> | 2015-05-11 14:41:24 -0700 |
---|---|---|
committer | Tim Emiola <tbetbetbe@users.noreply.github.com> | 2015-05-11 14:41:24 -0700 |
commit | 55e04e4e055794d400f8736c1c9a921f581a6589 (patch) | |
tree | d6a250582179af93afd9743efaf199daa7417851 /src | |
parent | 903810191e19ef0d2bb593815b0b5277b3eb5487 (diff) | |
parent | 57e7dc8e8dbc9ac55d5491d7d956f6981e4d3a94 (diff) |
Merge pull request #1543 from eavgerinos/patch-2
Ruby style changes: replace `== 0` with `zero?`
Diffstat (limited to 'src')
-rwxr-xr-x | src/ruby/bin/math_server.rb | 4 | ||||
-rw-r--r-- | src/ruby/lib/grpc/core/time_consts.rb | 2 | ||||
-rw-r--r-- | src/ruby/lib/grpc/generic/rpc_server.rb | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/ruby/bin/math_server.rb b/src/ruby/bin/math_server.rb index 1bfe253b85..e46d9c671f 100755 --- a/src/ruby/bin/math_server.rb +++ b/src/ruby/bin/math_server.rb @@ -55,7 +55,7 @@ class Fibber return enum_for(:generator) unless block_given? idx, current, previous = 0, 1, 1 until idx == @limit - if idx == 0 || idx == 1 + if idx.zero? || idx == 1 yield Math::Num.new(num: 1) idx += 1 next @@ -94,7 +94,7 @@ end # package. That practice should be avoided by defining real services. class Calculator < Math::Math::Service def div(div_args, _call) - if div_args.divisor == 0 + if div_args.divisor.zero? # To send non-OK status handlers raise a StatusError with the code and # and detail they want sent as a Status. fail GRPC::StatusError.new(GRPC::Status::INVALID_ARGUMENT, diff --git a/src/ruby/lib/grpc/core/time_consts.rb b/src/ruby/lib/grpc/core/time_consts.rb index 7750cb0feb..e6dae7b08a 100644 --- a/src/ruby/lib/grpc/core/time_consts.rb +++ b/src/ruby/lib/grpc/core/time_consts.rb @@ -58,7 +58,7 @@ module GRPC "Cannot make an absolute deadline from #{timeish.inspect}") elsif timeish < 0 TimeConsts::INFINITE_FUTURE - elsif timeish == 0 + elsif timeish.zero? TimeConsts::ZERO else Time.now + timeish diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb index 424719304e..de22466089 100644 --- a/src/ruby/lib/grpc/generic/rpc_server.rb +++ b/src/ruby/lib/grpc/generic/rpc_server.rb @@ -146,7 +146,7 @@ module GRPC def remove_current_thread @stop_mutex.synchronize do @workers.delete(Thread.current) - @stop_cond.signal if @workers.size == 0 + @stop_cond.signal if @workers.size.zero? end end @@ -364,7 +364,7 @@ module GRPC # - #running? returns true after this is called, until #stop cause the # the server to stop. def run - if rpc_descs.size == 0 + if rpc_descs.size.zero? logger.warn('did not run as no services were present') return end @@ -455,7 +455,7 @@ module GRPC unless cls.include?(GenericService) fail "#{cls} must 'include GenericService'" end - if cls.rpc_descs.size == 0 + if cls.rpc_descs.size.zero? fail "#{cls} should specify some rpc descriptions" end cls.assert_rpc_descs_have_methods |