Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
57e7dc8e
Commit
57e7dc8e
authored
9 years ago
by
Aggelos Avgerinos
Browse files
Options
Downloads
Patches
Plain Diff
Ruby style changes: replace `== 0` with `zero?`
parent
cc193a66
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ruby/bin/math_server.rb
+2
-2
2 additions, 2 deletions
src/ruby/bin/math_server.rb
src/ruby/lib/grpc/core/time_consts.rb
+1
-1
1 addition, 1 deletion
src/ruby/lib/grpc/core/time_consts.rb
src/ruby/lib/grpc/generic/rpc_server.rb
+3
-3
3 additions, 3 deletions
src/ruby/lib/grpc/generic/rpc_server.rb
with
6 additions
and
6 deletions
src/ruby/bin/math_server.rb
+
2
−
2
View file @
57e7dc8e
...
@@ -55,7 +55,7 @@ class Fibber
...
@@ -55,7 +55,7 @@ class Fibber
return
enum_for
(
:generator
)
unless
block_given?
return
enum_for
(
:generator
)
unless
block_given?
idx
,
current
,
previous
=
0
,
1
,
1
idx
,
current
,
previous
=
0
,
1
,
1
until
idx
==
@limit
until
idx
==
@limit
if
idx
==
0
||
idx
==
1
if
idx
.
zero?
||
idx
==
1
yield
Math
::
Num
.
new
(
num:
1
)
yield
Math
::
Num
.
new
(
num:
1
)
idx
+=
1
idx
+=
1
next
next
...
@@ -94,7 +94,7 @@ end
...
@@ -94,7 +94,7 @@ end
# package. That practice should be avoided by defining real services.
# package. That practice should be avoided by defining real services.
class
Calculator
<
Math
::
Math
::
Service
class
Calculator
<
Math
::
Math
::
Service
def
div
(
div_args
,
_call
)
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
# To send non-OK status handlers raise a StatusError with the code and
# and detail they want sent as a Status.
# and detail they want sent as a Status.
fail
GRPC
::
StatusError
.
new
(
GRPC
::
Status
::
INVALID_ARGUMENT
,
fail
GRPC
::
StatusError
.
new
(
GRPC
::
Status
::
INVALID_ARGUMENT
,
...
...
This diff is collapsed.
Click to expand it.
src/ruby/lib/grpc/core/time_consts.rb
+
1
−
1
View file @
57e7dc8e
...
@@ -58,7 +58,7 @@ module GRPC
...
@@ -58,7 +58,7 @@ module GRPC
"Cannot make an absolute deadline from
#{
timeish
.
inspect
}
"
)
"Cannot make an absolute deadline from
#{
timeish
.
inspect
}
"
)
elsif
timeish
<
0
elsif
timeish
<
0
TimeConsts
::
INFINITE_FUTURE
TimeConsts
::
INFINITE_FUTURE
elsif
timeish
==
0
elsif
timeish
.
zero?
TimeConsts
::
ZERO
TimeConsts
::
ZERO
else
else
Time
.
now
+
timeish
Time
.
now
+
timeish
...
...
This diff is collapsed.
Click to expand it.
src/ruby/lib/grpc/generic/rpc_server.rb
+
3
−
3
View file @
57e7dc8e
...
@@ -146,7 +146,7 @@ module GRPC
...
@@ -146,7 +146,7 @@ module GRPC
def
remove_current_thread
def
remove_current_thread
@stop_mutex
.
synchronize
do
@stop_mutex
.
synchronize
do
@workers
.
delete
(
Thread
.
current
)
@workers
.
delete
(
Thread
.
current
)
@stop_cond
.
signal
if
@workers
.
size
==
0
@stop_cond
.
signal
if
@workers
.
size
.
zero?
end
end
end
end
...
@@ -364,7 +364,7 @@ module GRPC
...
@@ -364,7 +364,7 @@ module GRPC
# - #running? returns true after this is called, until #stop cause the
# - #running? returns true after this is called, until #stop cause the
# the server to stop.
# the server to stop.
def
run
def
run
if
rpc_descs
.
size
==
0
if
rpc_descs
.
size
.
zero?
logger
.
warn
(
'did not run as no services were present'
)
logger
.
warn
(
'did not run as no services were present'
)
return
return
end
end
...
@@ -455,7 +455,7 @@ module GRPC
...
@@ -455,7 +455,7 @@ module GRPC
unless
cls
.
include?
(
GenericService
)
unless
cls
.
include?
(
GenericService
)
fail
"
#{
cls
}
must 'include GenericService'"
fail
"
#{
cls
}
must 'include GenericService'"
end
end
if
cls
.
rpc_descs
.
size
==
0
if
cls
.
rpc_descs
.
size
.
zero?
fail
"
#{
cls
}
should specify some rpc descriptions"
fail
"
#{
cls
}
should specify some rpc descriptions"
end
end
cls
.
assert_rpc_descs_have_methods
cls
.
assert_rpc_descs_have_methods
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment