Add Array.new([1,2,3]) initialization.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-11-05 14:12:42 +09:00
parent aa4d8e9a2b
commit afba74ff50
+4
View File
@@ -66,6 +66,10 @@ class Array
#
# ISO 15.2.12.5.15
def initialize(size=0, obj=nil, &block)
if size.is_a?(Array) && obj==nil && block == nil
self.replace(size)
return self
end
size = size.__to_int
raise ArgumentError, "negative array size" if size < 0