summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-array-ext
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-04-28 17:45:19 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-04-28 17:45:19 +0900
commitaff3743c129602d7757d2ffd690afcd42cc9cdc3 (patch)
treecd0b652a960edd24bcb9c453d33ca98b5ce5dcc6 /mrbgems/mruby-array-ext
parent9f77232b71597dbef3907ae4aaae1a5530889e56 (diff)
downloadmruby-aff3743c129602d7757d2ffd690afcd42cc9cdc3.tar.gz
mruby-aff3743c129602d7757d2ffd690afcd42cc9cdc3.zip
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.
Diffstat (limited to 'mrbgems/mruby-array-ext')
-rw-r--r--mrbgems/mruby-array-ext/mrblib/array.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-array-ext/mrblib/array.rb b/mrbgems/mruby-array-ext/mrblib/array.rb
index becfcb3ca..ecd09aa6e 100644
--- a/mrbgems/mruby-array-ext/mrblib/array.rb
+++ b/mrbgems/mruby-array-ext/mrblib/array.rb
@@ -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