Skip to content

Instantly share code, notes, and snippets.

@julioterra
Created October 5, 2011 18:22
Show Gist options
  • Select an option

  • Save julioterra/1265235 to your computer and use it in GitHub Desktop.

Select an option

Save julioterra/1265235 to your computer and use it in GitHub Desktop.
creating an enumerator with the Enumerator.new without using an iterator
enum_silly = Enumerator.new do |yielder|
yielder << "rock"
yielder << "paper"
yielder << "scissors"
end
enum_silly.each {|n| puts n}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment