Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
IronRuby + C#
using System;
using Microsoft.Scripting.Hosting;
using IronRuby;
namespace IronRubyHostTest
{
public class Meh
{
public void baz()
{
Console.WriteLine("Baz");
}
}
class Program
{
static void Main(string[] args)
{
string script = @"
require 'IronRubyHostTest.exe'
class Foo < IronRubyHostTest::Meh
def bar
puts 'foo baz'
end
def baz
puts 'BAZ BAZ BAZ'
end
end
Foo.new";
ScriptEngine engine = Ruby.CreateEngine();
dynamic foo = engine.Execute(script);
foo.baz();
foo.bar();
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.