They are located on the global scope, so just pass null as the object. For
example, the next code executes the add method that is defined on the global
scope:

ScriptEngine engine = IronRuby.Ruby.CreateEngine();
engine.Execute("def add(a,b); a + b; end");
object o = engine.Operations.InvokeMember(null, "add", 1, 2);
Console.WriteLine(o); // Print 3

Shay.
----------------------------
Shay Friedman
Author of IronRuby Unleashed
http://www.IronShay.com
Follow me: http://twitter.com/ironshay

On Thu, Oct 1, 2009 at 2:58 PM, Eelco Henderichs <li...@ruby-forum.com>wrote:

> Dear users,
>
> I have found how to invoke class methods and use its result in the C#
> application.
>
> However I can't seem to find how to invoke methodes located outside of a
> class. So I started wondering if this is at all possible. If it is, I
> would like to know how.
>
> Thanks in advance
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core@rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to