Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
35da84bf
Commit
35da84bf
authored
Oct 11, 2019
by
Joshua Haberman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ported names fix for Ruby to the release branch.
parent
6d4e7fd7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
protobuf.rb
ruby/lib/google/protobuf.rb
+12
-8
No files found.
ruby/lib/google/protobuf.rb
View file @
35da84bf
...
...
@@ -56,15 +56,19 @@ else
module
Internal
def
self
.
infer_package
(
names
)
# Package is longest common prefix ending in '.', if any.
min
,
max
=
names
.
minmax
last_common_dot
=
nil
min
.
size
.
times
{
|
i
|
if
min
[
i
]
!=
max
[
i
]
then
break
end
if
min
[
i
]
==
?.
then
last_common_dot
=
i
end
}
if
last_common_dot
return
min
.
slice
(
0
,
last_common_dot
)
if
not
names
.
empty?
min
,
max
=
names
.
minmax
last_common_dot
=
nil
min
.
size
.
times
{
|
i
|
if
min
[
i
]
!=
max
[
i
]
then
break
end
if
min
[
i
]
==
?.
then
last_common_dot
=
i
end
}
if
last_common_dot
return
min
.
slice
(
0
,
last_common_dot
)
end
end
nil
end
class
NestingBuilder
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment