Skip to content

Instantly share code, notes, and snippets.

Avatar
👻

Jonathan Dance (JD) wuputah

👻
View GitHub Profile
@wuputah
wuputah / later.rb
Created Sep 17, 2012
Later: a simple thread proxy
View later.rb
# +Later+ is a typical object proxy built around a Thread. You pass it a block
# and it will start performing that task in a Thread. Later, you can call any
# method on the object and it will proxy the call to the return value from
# +Thread#value+ (which joins the thread).
#
# Example:
#
# data = [
# Later { open("http://google.com") },
# Later { open("http://duckduckgo.com") },