You''re right. The Hosting API is currently under (re)construction.
Therefore the example is currently not so nice:
IScriptEnvironment runtime = ScriptEnvironment.GetEnvironment();
IScriptEngine engine = IronRuby.GetEngine(runtime);
IScriptScope scope = engine.CreateScope();
List<string> strings = new List<string>();
strings.Add("one");
strings.Add("two");
IronRuby.GetExecutionContext(runtime).GlobalVariables[SymbolTable.StringToId("strings")]
= strings;
SourceUnit script = engine.CreateScriptSourceFromString(
@"
puts ""Hello World! There are #{$strings.count.to_s}
strings:""
$strings.each_with_index { |s,i| puts ""#{i}: #{s}"" }
");
engine.Execute(scope, script);
It will get better soon.
Tomas
-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Thibaut Barr?re
Sent: Saturday, January 05, 2008 7:19 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] Up-to-date hosting sample ?
Hi!
I''m preparing an IronRuby article for a french newspaper, and would
like to demonstrate the hosting features (possibly to show how to
build a small dsl to script a C# application for instance).
I''m sitting on SVN at revision 68 but can''t get the wiki
sample [1] to
compile - I believe the hosting stuff is currently under heavy
modification, right ?
Does anyone have an up-to-date hosting sample, or should I go back a
few revisions ?
cheers!
[1] http://ironruby.rubyforge.org/wiki/wiki.pl?ExecutingIronRubyFromCSharp
Thibaut Barr?re
--
LoGeek
http://evolvingworker.com - tools for a better day
http://blog.logeek.fr - about writing software
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core