summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-array-ext
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-11-05 14:25:01 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-11-05 14:29:26 +0900
commitd9bd77b180a6f9832d5a016af0be29e3399bd8b1 (patch)
treef262b7de5ae7321978e0c78c805b3eccf53028d4 /mrbgems/mruby-array-ext
parent4e535080dc56bf803bae563abd8baf28b976cdd7 (diff)
downloadmruby-d9bd77b180a6f9832d5a016af0be29e3399bd8b1.tar.gz
mruby-d9bd77b180a6f9832d5a016af0be29e3399bd8b1.zip
Fix `A.new([[1,2],3]).flatten` to return `Array`.
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 f3246af4f..25669a9ab 100644
--- a/mrbgems/mruby-array-ext/mrblib/array.rb
+++ b/mrbgems/mruby-array-ext/mrblib/array.rb
@@ -209,7 +209,7 @@ class Array
# a.flatten(1) #=> [1, 2, 3, [4, 5]]
#
def flatten(depth=nil)
- res = dup
+ res = Array.new(self)
res.flatten! depth
res
end