>From C#, is it possible to new up an instance of an IronRuby class andthen 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.
No worries, I''ve found what I need in Phil Haack''s IronRuby view engine sample. Cheers, Andrew. On Fri, Oct 31, 2008 at 12:25 AM, Andrew Peters <andrew at mindscape.co.nz> wrote:> 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. >
Cool. Now you can provide an answer when the next person asks. :) -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Andrew Peters Sent: Thursday, October 30, 2008 6:40 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Another Interop Question No worries, I''ve found what I need in Phil Haack''s IronRuby view engine sample. Cheers, Andrew. On Fri, Oct 31, 2008 at 12:25 AM, Andrew Peters <andrew at mindscape.co.nz> wrote:> 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. >_______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core