Created
July 26, 2014 22:50
-
-
Save havenwood/c0f936043592d3020adc to your computer and use it in GitHub Desktop.
Future
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 Future | |
def initialize &work | |
@worker = Thread.new &work | |
end | |
def ready? | |
@worker.alive? | |
end | |
def value | |
@worker.value | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment