warning: default `to_a’ will be obsolete

ruby Add comments

Apparently Object.to_a will eventually be obsolete (not sure when).  I was using it in the following context:

def foo(args)
  args.to_a.join(',')
end

According to this very old ruby-lang thread, this [*args] is a suitable alternative:

def foo(args)
  [*args].join(',')
end

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in