method
to_a
Ruby latest stable (v2_5_5)
-
1 note -
Class: Object
- 1_8_6_287 (0)
- 1_8_7_72 (0)
- 1_8_7_330 (0)
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
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"]
Register or
log in
to add new notes.
tobico -
February 25, 2013
0 thanks
Where did this go?
For Ruby 1.9 and later, use Kernel#Array to get this functionality.