Assoc
a = [:one, [1,2,3]]
p a.assoc(:one)[1..][0] # => [1, 2, 3]
a << [:two, {a: :allan, b: :bengt}]
p a.assoc(:two)[1..][0] # => {:a => :allan, :b => :bengt}
So - with this one command - an Array can be used as a Hash.
Add to that the plethora of Array methods (including rassoc
); the possibility to turn a array into an enumerator.. and you see you can go far beyond Hashes.