Implementing data structures in Ruby