Created
December 12, 2009 08:24
-
-
Save jschementi/254800 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// create a ScriptRuntime, the portal to the DLR Hosting API | |
// CreateFromConfiguration gets information, like languages | |
// are available, from an app.config configuration file | |
var runtime = ScriptRuntime.CreateFromConfiguration(); | |
// create a ScriptEngine for IronRuby | |
var engine = runtime.GetEngine("IronRuby"); | |
// a ScriptScope stores state between executions | |
var scope = engine.CreateScope(); | |
// expose the current instance as "window" to the scripts | |
scope.SetVariable("window", this); | |
// execute a script against the scope, which modifies | |
// that "window" variable set previously. | |
engine.Execute("window.Message.Text = 'Hello from Ruby!'", scope); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment