Here's how you interact:
Make sure you have links to IronRuby , IronRuby.Libraries , Microsoft.Scripting and Microsoft.Scripting.Core
using System; using System.Collections.Generic; using System.Linq; using System.Text; using IronRuby; using IronRuby.Builtins; using IronRuby.Runtime; namespace ConsoleApplication7 { class Program { static void Main(string[] args) { var runtime = Ruby.CreateRuntime(); var engine = runtime.GetRubyEngine(); engine.Execute("def hello; puts 'hello world'; end"); string s = engine.Execute("hello") as string; Console.WriteLine(s);
Note. Runtime has an ExecuteFile that you can use to execute your file.
To get Gems go
- Make sure you install your gem using
igem.exe - you may have to set up multiple search paths using Engine.SetSearchPaths
source share