Porting Andrew Kandels' "Contain" to Ruby