method

to_a

Importance_2
v1_8_6_287 - Show latest stable - 1 note - Class: Object
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"]
Show source
Register or log in to add new notes.
February 25, 2013
0 thanks

Where did this go?

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