Flowdock
Array(p1) public

Returns arg as an Array.

First tries to call to_ary on arg, then to_a. If arg does not respond to to_ary or to_a, returns an Array of length 1 containing arg.

If to_ary or to_a returns something other than an Array, raises a TypeError.

Array(["a", "b"])  #=> ["a", "b"]
Array(1..5)        #=> [1, 2, 3, 4, 5]
Array(key: :value) #=> [[:key, :value]]
Array(nil)         #=> []
Array(1)           #=> [1]
Show source
Register or log in to add new notes.