Re: [Ironruby-core] calling non class methods from C#

2009-10-02 Thread Eelco Henderichs
Oke thanks for the information. Not sure if I fully understand how to do this. But it surely gave me someting to work with and I can start experimenting with it. -- Posted via http://www.ruby-forum.com/. ___ Ironruby-core mailing list Ironruby-core@rub

Re: [Ironruby-core] calling non class methods from C#

2009-10-01 Thread Tomas Matousek
Shay Friedman Sent: Thursday, October 01, 2009 6:31 AM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] calling non class methods from C# 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 t

Re: [Ironruby-core] calling non class methods from C#

2009-10-01 Thread Ivan Porto Carrero
class TheExample def output "Hello World" end end var operations = Engine.CreateOperations(); Engine.ExecuteFile(/path/to/example.rb); var instance = operations.CreateInstance(); var result = operations.InvokeMember(instance, "output"); --- Met vriendelijke groeten - Best regards - Salutati

Re: [Ironruby-core] calling non class methods from C#

2009-10-01 Thread Shay Friedman
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(n