Odd. It works for me. Here's my complete code:
namespace ConsoleApplication2 {
class Program {
static void Main(string[] args) {
var engine = IronRuby.Ruby.CreateEngine();
engine.Execute(@"
class Person
def greet()
puts 'hello world'
end
end
");
object personClass = engine.Runtime.Globals.GetVariable("Person");
dynamic person = engine.Operations.CreateInstance(personClass);
person.greet();
System.Console.ReadLine();
}
}
}
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mohammad Azam
Sent: Tuesday, June 09, 2009 8:37 PM
To: [email protected]
Subject: Re: [Ironruby-core] How to fire IronRuby Method from C#
Curt Hagenlocher wrote:
> Yes, sorry, you're right -- it's Engine.Operations (but the name of the
> class is "ObjectOperations").
>
> The error message tells you exactly what you need to do! Make sure
> you've added references to Microsoft.CSharp.dll and System.Core.dll to
> your project.
The error is now gone! but I got the new error which says:
RubyObject does not contain the definition for greet!
object personClass = engine.Runtime.Globals.GetVariable("Person");
dynamic person =
engine.Operations.CreateInstance(personClass);
person.greet();
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core