From: Pen Ttt on
would you mind to tell me how to fix it, to make the following program
to run?
require 'rubygems'
require 'open-uri'
open(url){|file| if url don't exists then puts "url don't exists"
else puts "url exists"}
Posted via

From: Pen Ttt on
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'open-uri'
=> true
irb(main):003:0> url = URI.parse('')
=> #<URI::Generic:0xb764ff84>
irb(main):004:0> status = Net::HTTP.start(, url.port) {|http|
irb(main):005:1* http.head(url.path)
irb(main):006:1> }
NameError: uninitialized constant Net
from (irb):4
from :0
irb(main):007:0> puts( /^2/ =~ status.code ? "ok" : "nok" )
NoMethodError: undefined method `code' for nil:NilClass
from (irb):7
from :0
Posted via

From: Jean-Julien Fleck on
> NameError: uninitialized constant Net

require 'net/http'

JJ Fleck
PCSI1 Lycée Kléber