Created
April 20, 2011 07:40
-
-
Save masarakki/930611 to your computer and use it in GitHub Desktop.
sample of fiber
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
miko = Fiber.new do | |
cnt = 0 | |
puts "みなさーん 元気ですかー!" | |
Fiber.yield | |
puts "それでは早速、いってみよー!" | |
Fiber.yield | |
puts "ハイ、1.2.3.ナース!!" | |
Fiber.yield | |
s = %w{生麦生米 カエルぴょこぴょこ セクシャルバイオレット ソウルトレイン 姉三六角 立直一発} | |
s.length.times do | |
2.times { puts "巫女みこナース!" } | |
Fiber.yield | |
puts "#{s[cnt]} 巫女みこナース!" | |
Fiber.yield | |
cnt += 1 | |
end | |
3.times do | |
puts "巫女みこナース!" | |
puts "巫女みこナース!" | |
Fiber.yield | |
end | |
puts "最後にもいっちょー、ハイ!" | |
Fiber.yield | |
puts "巫女みこナース!" | |
Fiber.yield | |
end | |
while(!gets.nil?) | |
miko.resume | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment