mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user