public
Created

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
require 'celluloid'
require 'net/http'
 
class MarkupPutter
include Celluloid
 
def initialize(url)
@url = url
end
 
def output(markup_future)
puts "#{@url}"
puts "#{markup_future.value}"
puts "----------------------------"
end
def get_markup
Net::HTTP.get(URI.parse(@url))
end
end
 
websites = ["http://google.com/", "http://yahoo.com/", "http://rubysource.com/", "http://tumblr.com/"]
 
websites.each do |website|
mp = MarkupPutter.new website
markup_future = mp.future :get_markup
mp.output markup_future
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.