Skip to content
instance method

Hash#to_a

() -> ::Array[[ K, V ]]
to_a → new_array

Returns all elements of self as an array of 2-element arrays; each nested array contains a key-value pair from self:

Example
h = {foo: 0, bar: 1, baz: 2}
h.to_a # => [[:foo, 0], [:bar, 1], [:baz, 2]]

Related: see Methods for Converting.

See also #store #to_h #slice #to_hash also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0