Created
June 21, 2011 19:47
-
-
Save FredrikL/1038709 to your computer and use it in GitHub Desktop.
IronRuby + C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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