Created
September 22, 2010 01:56
-
-
Save hackervera/590986 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| require 'rubygems' | |
| require 'httparty' | |
| def async(arg,callback) | |
| Thread.new { | |
| sleep 10 | |
| resp = HTTParty.get(arg) | |
| callback.call(resp) | |
| } | |
| end | |
| host = "http://www.google.com" | |
| thr = async(host,lambda { |resp| puts resp }) | |
| puts "getting #{host}" | |
| thr.join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment