Skip to content

Commit dbb4574

Browse files
committed
Cleanups
1 parent e68b579 commit dbb4574

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/main/ruby/truffleruby/core/array.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ def sample(count=undefined, options=undefined)
10061006
end
10071007
end
10081008

1009-
def sample_many(count, rng)
1009+
private def sample_many(count, rng)
10101010
if count <= 70 # three implementations; choice determined experimentally
10111011
if 2.0 * size / count <= count + 13
10121012
sample_many_swap(count, rng)
@@ -1021,19 +1021,18 @@ def sample_many(count, rng)
10211021
end
10221022
end
10231023
end
1024-
private :sample_many
10251024

1026-
def sample_many_swap(count, rng)
1027-
#linear dependence on array size, therefore very slow for small count / size
1025+
private def sample_many_swap(count, rng)
1026+
# linear dependence on array size, therefore very slow for small count / size
10281027
result = Array.new(self)
10291028

10301029
count.times do |c|
10311030
result.__send__ :swap, c, rng.rand(size)
10321031
end
10331032
end
10341033

1035-
def sample_many_quad(count, rng)
1036-
#quadratic time due to linear time collision check but low overhead
1034+
private def sample_many_quad(count, rng)
1035+
# quadratic time due to linear time collision check but low overhead
10371036
result = Array.new count
10381037
i = 1
10391038

@@ -1075,7 +1074,7 @@ def sample_many_quad(count, rng)
10751074
result
10761075
end
10771076

1078-
def sample_many_hash(count, rng)
1077+
private def sample_many_hash(count, rng)
10791078
# use hash for constant time collision check but higher overhead
10801079
result = Array.new count
10811080
i = 1
@@ -1117,7 +1116,6 @@ def select!(&block)
11171116
ary = select(&block)
11181117
Primitive.steal_array_storage(self, ary) unless size == ary.size
11191118
end
1120-
11211119
alias_method :filter!, :select!
11221120

11231121
def shuffle(options = undefined)
@@ -1226,7 +1224,6 @@ def unshift(*values)
12261224

12271225
self
12281226
end
1229-
12301227
alias_method :prepend, :unshift
12311228

12321229
def values_at(*args)

0 commit comments

Comments
 (0)