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

Ivan Porto Carrero ivan at flanders.co.nz
Wed Jun 17 13:21:50 EDT 2009


what version of ironruby are you using?it looks like your search paths are
messed up.

for example does require File.dirname(__FILE__) + '/libs/open-uri' work?

---
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)



On Wed, Jun 17, 2009 at 6:55 PM, Mohammad Azam <lists at ruby-forum.com> wrote:

>
> 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/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090617/63c01872/attachment.html>


More information about the Ironruby-core mailing list