mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Add Array.new([1,2,3]) initialization.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user