Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
3883a381
Commit
3883a381
authored
Apr 13, 2011
by
antirez
Browse files
use map! instead of reassigning
parent
583fc5dd
Changes
1
Show whitespace changes
Inline
Side-by-side
src/redis-trib.rb
View file @
3883a381
...
@@ -92,7 +92,7 @@ class ClusterNode
...
@@ -92,7 +92,7 @@ class ClusterNode
# As we want to aggregate adiacent slots we convert all the
# As we want to aggregate adiacent slots we convert all the
# slot integers into ranges (with just one element)
# slot integers into ranges (with just one element)
# So we have something like [1..1,2..2, ... and so forth.
# So we have something like [1..1,2..2, ... and so forth.
slots
=
slots
.
map
{
|
x
|
x
..
x
}
slots
.
map
!
{
|
x
|
x
..
x
}
# Finally we group ranges with adiacent elements.
# Finally we group ranges with adiacent elements.
slots
=
slots
.
reduce
([])
{
|
a
,
b
|
slots
=
slots
.
reduce
([])
{
|
a
,
b
|
...
...
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