[Ironruby-core] Accessing open-uri from the same directory

Mohammad Azam lists at ruby-forum.com
Wed Jun 17 12:55:31 EDT 2009


If I put:

require 'open-uri'

then it throws the error that error locating the file 'open-uri'.

I used the following code:

def scrape_page()

uri = URI.parse("http://somewhere.com/default.aspx")

end

And now it throws the exception:

Unintitialzied constant Object: URI



Ivan Porto carrero wrote:
> if you have openuri required
> just remove the File that should work
> or
> 
> uri = URI.parse("http://somewhere.com/default.aspx")
> uri.open do |f|
>   #some logic here
> end
> 
> or
> 
> you could just use
> 
> open("http://somewhere.com/default.aspx") do |f|
>    # some logic here
> end
> 
> taken from
> http://www.ruby-doc.org/stdlib/libdoc/open-uri/rdoc/classes/OpenURI.html
> ---
> Met vriendelijke groeten - Best regards - Salutations
> Ivan Porto Carrero
> Blog: http://flanders.co.nz
> Twitter: http://twitter.com/casualjim
> Author of IronRuby in Action (http://manning.com/carrero)

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


More information about the Ironruby-core mailing list