map.rb, quality software by Ara T. Howard:
the awesome ruby container you've always wanted: a string/symbol indifferent ordered hash that works in all rubies
m = Map.new
m[:a] = 0 m[:b] = 1 m[:c] = 2
p m.keys #=> [‘a’,‘b’,‘c’] ### always ordered! p m.values #=> [0,1,2] ### always ordered!
m = Map(:foo => {:bar => 42}) s = m.struct # maps can give back clever little struct objects p s.foo.bar #=> 42
I like little tactical improvements to the Ruby standard library that give it a slightly more modern feel.