From: Toki Toki Date: 2008-07-25T06:19:37+09:00 Subject: Re: Simultaneously URL call, is it possible? I単aki Baz Castillo wrote: > El Jueves, 24 de Julio de 2008, Toki Toki escribi坦: >> It's not clear the first line of your code, could you explain it? > > %w[uri net/http].each{|l|require l} > > > %w[aaa bbb ccc] is an Array: > > irb> %w[aaa bbb ccc] > ["aaa", "bbb", "ccc"] > > so it's a "each" method of an Array so: > > require "uri" > require "net/http" > > Well, I think is too much freak XD Ok, so this: %w[uri net/http].each{|l|require l} 10.times do Thread.new {Net::HTTP.get_response(URI.parse('http://www.google.com/'))} end is equal to this: require 'net/http' require 'uri' 10.times do Thread.new {Net::HTTP.get_response(URI.parse('http://www.google.com/'))} end Good, I've never used require with array. But if I run the code above I get an error: url_call.rb:4: odd number list for Hash I think it's because of the curly braces that are viewed like an hash, right? I don't know how Thread works in Ruby, but it seems that the statements in the curly braces need to be on the same line as Thread.new otherwise it give the error above... -- Posted via http://www.ruby-forum.com/.