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.
parent 9f77232b
...@@ -51,7 +51,7 @@ class Array ...@@ -51,7 +51,7 @@ class Array
# b.uniq { |s| s.first } # => [["student", "sam"], ["teacher", "matz"]] # b.uniq { |s| s.first } # => [["student", "sam"], ["teacher", "matz"]]
# #
def uniq(&block) def uniq(&block)
ary = self.dup ary = self[0..-1]
ary.uniq!(&block) ary.uniq!(&block)
ary ary
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment