[Ironruby-core] Compiling .rb files vs. embedding and hosting ?

Jimmy Schementi Jimmy.Schementi at microsoft.com
Fri Jan 9 14:42:36 EST 2009

Embedding the files as resources would be your best bet, as we don't have compilation to an assembly working today.

Basically (compiled with outlook ...):

var assembly = Assembly.GetExecutingAssembly();
var textStreamReader = new StreamReader(assembly.GetManifestResourceStream("foo.rb"));
var code = textStreamReader.ReadToEnd();

var runtime = new ScriptRuntime();
var ruby = IronRuby.Ruby.GetEngine(runtime);
var source = ruby.CreateScriptSourceFromString(code);
var result = source.Execute();

Compilation is something we want to support though.


> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-
> bounces at rubyforge.org] On Behalf Of Thibaut Barrère
> Sent: Friday, January 09, 2009 2:34 AM
> To: ironruby-core
> Subject: [Ironruby-core] Compiling .rb files vs. embedding and hosting
> ?
> Hello,
> I'm starting to integrate IronRuby files into a VisualStudio C#
> project, mainly to write easy-to-maintain GUI builders.
> As I don't want to have .rb files lying around this deployment, I had
> that idea about embedding all the files inside an assembly, loading
> them at run time through resource manager and passing them to the
> IronRuby host I would start from C#.
> While that would work, it would be even simplier to have these .rb
> files compiled to some assembly.
> Is there a trick to compile a bunch of .rb files to an assembly today ?
> thanks!
> -- Thibaut

More information about the Ironruby-core mailing list