A
Ace Mutha
Hi all I have this prog taken from a book.
require 'net/http'
pages = ["www.rubycentral.com", "www.awl.com", "www.davidecasale.com"]
threads = []
pages.each do |page|
threads << Thread.new(page) { |myPage|
h = Net::HTTP.new(myPage, 80)
puts "Fetching: #{myPage}"
resp, data = h.get('/', nil )
puts "Got #{myPage}: #{resp.message}"
}
end
but when i run it It gives me this error.
/usr/local/lib/ruby/1.9.1/net/http.rb:809:in `get': undefined method
`keys' for nil:NilClass (NoMethodError) from Threads.rb:19:in `block (2
levels) in <main>'
It's weird because it's working on ruby 1.8.7
require 'net/http'
pages = ["www.rubycentral.com", "www.awl.com", "www.davidecasale.com"]
threads = []
pages.each do |page|
threads << Thread.new(page) { |myPage|
h = Net::HTTP.new(myPage, 80)
puts "Fetching: #{myPage}"
resp, data = h.get('/', nil )
puts "Got #{myPage}: #{resp.message}"
}
end
but when i run it It gives me this error.
/usr/local/lib/ruby/1.9.1/net/http.rb:809:in `get': undefined method
`keys' for nil:NilClass (NoMethodError) from Threads.rb:19:in `block (2
levels) in <main>'
It's weird because it's working on ruby 1.8.7