How to use open-uri

Hi,

I am using the following code to do some screen scraping but it says “no
such file to load open-uri”.

Here is the code:

require ‘open-uri’
require ‘uri’

        class Person
        def greet()
        puts 'hello world'
        end

Thanks,
Azam

2009/6/10 Mohammad A. [email protected]:

I am using the following code to do some screen scraping but it says “no
such file to load open-uri”.

require ‘open-uri’ works for me. Which version of IronRuby are you
using?

Thanks for the reply!

Actually I am trying to run the open method using C#. Here is the code:

dynamic rubyPerson = (engine.Execute(@"
require ‘open-uri’

        class Person
        def greet()
        puts 'hello world'
        end

        end

        def getPerson()

        f = open('http://www.azamsharp.com/Default.aspx')

        end

        getPerson()
        "));

And here is the error:

no such file to load open-uri

I am using the following now:

var paths = new List();
paths.Add(@“C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libs”);

        scriptEngine.SetSearchPaths(paths);

But still the same error!

You may need to call ScriptEngine.SearchPaths to initialize the path.

Thanks I got it working using the following path:

var paths = new List();
paths.Add(@“C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libs”);
paths.Add(@“C:\ironruby\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\ruby\1.8”);