var engine = Ruby.CreateEngine(); var context = engine.CreateScope(); var rubyClass = engine.Runtime.GetRubyClass("String"); var rubyObject = rubyClass.CreateInstance(context);
var engine = Ruby.CreateEngine(); var context = engine.CreateScope(); var rubyClass = engine.Runtime.DefineRubyClass("MyClass"); rubyClass.DefineMethod("myMethod", (FuncIn this example, a new Ruby class is defined and a new method called "myMethod" is added to it. When the method is called, it prints "Hello, world!" to the console. IronRuby.Builtins RubyClass is part of the IronRuby package library, which is an implementation of the Ruby programming language that runs on the .NET Framework.)((ctx, args) => { Console.WriteLine("Hello, world!"); return null; }));