Hello, I’m new to ruby but so far my experience with Ruby has been
great. I’m unable to open an uri based on the file path.
This works
require ‘open-uri’
open(“http://www.ruby-lang.org/”) {|f|
f.each_line {|line| p line}
}
but this doesn’t
require ‘open-uri’
open(“file:c://test/test.txt”) {|f|
f.each_line {|line| p line}
}
Can Ruby uri class open up a file schema?
Thanks,
apparna
App Ra wrote:
but this doesn’t
require ‘open-uri’
open(“file:c://test/test.txt”) {|f|
f.each_line {|line| p line}
}
Can Ruby uri class open up a file schema?
Make a test without a drive letter. IOW try a simpler case first. Then,
if
this succeeds, try this syntax:
“file:///C:/test/test.txt”
URI paths involving drive letters must be handled very carefully. And
IMHO,
drive letters should be banished from the world of computing as soon as
possible.