Trying to use a method upto and place result into an array.
the below code loops through and run the curl command 6 times and place
results in “result” but its not an array.
1.upto(6) do |num|
puts num
result = system( “curl -Is -k --proxy http://one.proxy.com:8080
https://server#{num}-pod.com:8443” )
p result.inspect
end
I assume since the stdout is in the “result” then I could read through
it.
$c = 0
$bad = “”
1.upto(6) do |num|
puts num
result = system( “curl -Is -k --proxy http://one.proxy.com:8080
https://server#{num}-pod.com:8443” )
puts result
result.each do |line|
if line.include? “200”
$c += 1
puts $c
elsif line.to_s.include?(“https://master-server.com”)
$c += 1
puts $c
else
$bad += “#{line}\n”
puts $bad
end
end
end
I get the following error and any not sure what I am doing wrong? Or
maybe I am going about it all wrong.
NoMethodError: undefined method each' for true:TrueClass from (irb):32:in
block in irb_binding’
from (irb):28:in upto' from (irb):28 from /usr/local/rvm/rubies/ruby-1.9.3-p551/bin/irb:12:in
’