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
bae3a610
Commit
bae3a610
authored
9 years ago
by
Tim Emiola
Browse files
Options
Downloads
Patches
Plain Diff
Really removes the string monkey-patch
parent
13363e31
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ruby/lib/grpc/generic/rpc_server.rb
+3
-2
3 additions, 2 deletions
src/ruby/lib/grpc/generic/rpc_server.rb
src/ruby/lib/grpc/generic/service.rb
+0
-18
0 additions, 18 deletions
src/ruby/lib/grpc/generic/service.rb
with
3 additions
and
20 deletions
src/ruby/lib/grpc/generic/rpc_server.rb
+
3
−
2
View file @
bae3a610
...
...
@@ -468,10 +468,11 @@ module GRPC
route
=
"/
#{
cls
.
service_name
}
/
#{
name
}
"
.
to_sym
fail
"already registered: rpc
#{
route
}
from
#{
spec
}
"
if
specs
.
key?
route
specs
[
route
]
=
spec
rpc_name
=
GenericService
.
underscore
(
name
.
to_s
).
to_sym
if
service
.
is_a?
(
Class
)
handlers
[
route
]
=
cls
.
new
.
method
(
name
.
to_s
.
underscore
.
to_sym
)
handlers
[
route
]
=
cls
.
new
.
method
(
rpc_
name
)
else
handlers
[
route
]
=
service
.
method
(
name
.
to_s
.
underscore
.
to_sym
)
handlers
[
route
]
=
service
.
method
(
rpc_
name
)
end
logger
.
info
(
"handling
#{
route
}
with
#{
handlers
[
route
]
}
"
)
end
...
...
This diff is collapsed.
Click to expand it.
src/ruby/lib/grpc/generic/service.rb
+
0
−
18
View file @
bae3a610
...
...
@@ -30,24 +30,6 @@
require
'grpc/generic/client_stub'
require
'grpc/generic/rpc_desc'
# Extend String to add a method underscore
class
String
# creates a new string that is the underscore separate version of this one.
#
# E.g,
# PrintHTML -> print_html
# AMethod -> a_method
# AnRpc -> an_rpc
def
underscore
word
=
dup
word
.
gsub!
(
/([A-Z]+)([A-Z][a-z])/
,
'\1_\2'
)
word
.
gsub!
(
/([a-z\d])([A-Z])/
,
'\1_\2'
)
word
.
tr!
(
'-'
,
'_'
)
word
.
downcase!
word
end
end
# GRPC contains the General RPC module.
module
GRPC
# Provides behaviour used to implement schema-derived service classes.
...
...
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