mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
string-ext/string.rb: String#prepend to take multiple arguments.
This commit is contained in:
@@ -334,8 +334,12 @@ class String
|
||||
# a = "world"
|
||||
# a.prepend("hello ") #=> "hello world"
|
||||
# a #=> "hello world"
|
||||
def prepend(arg)
|
||||
self[0, 0] = arg
|
||||
def prepend(*args)
|
||||
len = args.size
|
||||
while len > 0
|
||||
len -= 1
|
||||
self[0, 0] = args[len]
|
||||
end
|
||||
self
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user