Why are you using *arg? This will take all the arguments of the method
call (there may be any number) and put them into an array, which is
referenced by arg.
For example:
···
#-------------------------
def f *args
puts "args is #{args.inspect}"
end
f(1, 2, 3) # args is [1, 2, 3]
f("a") # args is ["a"]
f() # args is #-------------------------
This is probably *not* what you want. You rather want the method to take
a single argument (the array) and return this argument:
#-------------------------
def repeat array
array
end #-------------------------
Of course this method doesn't make sense (and it works not only for
arrays but every object).