This method is deprecated or moved on the latest stable version.
The last existing version (v1_8_7_330) is shown here.
to_a()
public
Returns an array representation of obj. For objects of classObject and
others that don’t explicitly override the method, the return value is an
array containing self. However, this latter behavior will soon be
obsolete.
self.to_a#=> -:1: warning: default `to_a' will be obsolete"hello".to_a#=> ["hello"]Time.new.to_a#=> [39, 54, 8, 9, 4, 2003, 3, 99, true, "CDT"]
/*
* call-seq:
* obj.to_a -> anArray
*
* Returns an array representation of <i>obj</i>. For objects of class
* <code>Object</code> and others that don't explicitly override the
* method, the return value is an array containing <code>self</code>.
* However, this latter behavior will soon be obsolete.
*
* self.to_a #=> -:1: warning: default `to_a' will be obsolete
* "hello".to_a #=> ["hello"]
* Time.new.to_a #=> [39, 54, 8, 9, 4, 2003, 3, 99, true, "CDT"]
*/
static VALUE
rb_any_to_a(obj)
VALUE obj;
{
rb_warn("default `to_a' will be obsolete");
return rb_ary_new3(1, obj);
}
1Note
Where did this go?
tobico · Feb 25, 2013
For Ruby 1.9 and later, use Kernel#Array to get this functionality.