Ruby: Creating iterators