require 'enumerator'
class Foo
  def every
    yield 3
    yield 2
    yield 1
    yield 4
  end
end

foo = Foo.new
# Pass in the object and the iterator name...
enum = Enumerable::Enumerator.new(foo,:every)
enum.each {|x| p x }     # Print out the items
array = enum.to_a        # [3,2,1,4]
sorted = enum.sort       # [1,2,3,4]

