Last active
September 25, 2015 03:25
-
-
Save ir-norn/4e15a3581f95774873fd to your computer and use it in GitHub Desktop.
task
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
class Task | |
def initialize | |
@func =->{yield self} | |
end | |
def update | |
@func.call | |
end | |
end | |
task = [] | |
task << Task.new { p 2 } | |
task << Task.new { p 4 } | |
task << Task.new {|o| | |
p o | |
@n ||= 0 | |
exit if (@n+=1) > 10 | |
} | |
task.map &:update until nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment