Skip to content

Instantly share code, notes, and snippets.

@hanachin
Created October 10, 2012 16:45
Show Gist options
  • Save hanachin/3866799 to your computer and use it in GitHub Desktop.
Save hanachin/3866799 to your computer and use it in GitHub Desktop.
ポモドーロたん
require 'enumerable/lazy'
work = Enumerator.new {|y| loop { y << 25 } }
rest = Enumerator.new {|y| loop { 3.times { y << 5 }; y << 15 } }
pomodoro = work.lazy.zip(rest)
pomodoro.each {|set|
work_time, rest_time = set
case set
when [25, 5]
puts "normal"
when [25, 15]
puts "long"
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment