array.rb: Array#uniq to return always Array.

Even called for subclass of `Array`, according to new Ruby3.0 behavior.
Other methods of `Array` behave as Ruby3.0 from the first hand.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-04-28 17:45:19 +09:00
parent 9f77232b71
commit aff3743c12
+1 -1
View File
@@ -51,7 +51,7 @@ class Array
# b.uniq { |s| s.first } # => [["student", "sam"], ["teacher", "matz"]]
#
def uniq(&block)
ary = self.dup
ary = self[0..-1]
ary.uniq!(&block)
ary
end