method

to_a

ruby latest stable - Class: Object

Method deprecated or moved

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 class Object 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"]

1Note

Where did this go?

tobico · Feb 25, 2013

For Ruby 1.9 and later, use Kernel#Array to get this functionality.