Forum: IronRuby Another Interop Question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0e5987d3f0456799c5327d5ae47b72e1?d=identicon&s=25 Andrew Peters (Guest)
on 2008-10-30 12:26
(Received via mailing list)
>From C#, is it possible to new up an instance of an IronRuby class and
then invoke a method on it?

I.e:

var ruby = new StringBuilder();

ruby.AppendLine("class MyClass");
ruby.AppendLine("  def render");
ruby.AppendLine("    \"Hello!\"");
ruby.AppendLine("  end");
ruby.AppendLine("end");

var scriptEngine = Ruby.CreateEngine();

scriptEngine.Execute(ruby.ToString());

var action =
scriptEngine.CreateScriptSourceFromString("MyClass.method(:new)").Execute();

var o = scriptEngine.Operations.Call(action);

// how to invoke render?

Cheers,

Andrew.
0e5987d3f0456799c5327d5ae47b72e1?d=identicon&s=25 Andrew Peters (Guest)
on 2008-10-31 02:40
(Received via mailing list)
No worries, I've found what I need in Phil Haack's IronRuby view engine
sample.

Cheers,

Andrew.
F983f0c990cba2fe743ef62a975ec99c?d=identicon&s=25 Curt Hagenlocher (Guest)
on 2008-10-31 03:19
(Received via mailing list)
Cool.  Now you can provide an answer when the next person asks. :)
This topic is locked and can not be replied to.