Uri to absolute/relative path

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

···

--
Posted via http://www.ruby-forum.com/.

App Ra wrote:

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?

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.

···

--
Paul Lutus
http://www.arachnoid.com