[Ironruby-core] Getting started in VB?

Tomas Matousek Tomas.Matousek at microsoft.com
Thu Feb 26 01:43:23 EST 2009

This should work:

        Dim engine = IronRuby.Ruby.CreateEngine()
        Dim controllerClass = engine.Runtime.Globals.GetVariable("MyController")
        Dim controller = engine.Operations.CreateInstance(controllerClass)
        engine.Operations.InvokeMember(controller, "do_foo")


-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Mr X enterprises
Sent: Wednesday, February 25, 2009 9:13 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] Getting started in VB?

I'd like to use IronRuby to make some applications extensible, but I'm
having some problems getting started:

Here's code I run when you click a button:

runtime = ScriptRuntime.CreateFromConfiguration()
Dim engine As ScriptEngine = runtime.GetEngine("Ruby")
Dim code As String
code = String.Format("{0}.new.method :{1}", "MyController", "do_foo")
Dim action As ScriptSource = engine.CreateScriptSourceFromString(code)
Dim result As Object

result = engine.Operations.Call(action, 1, 2)
'^I get an exception saying: The method or operation is not implemented.

Me.TextBox1.Text = result.ToString()

Here is the ruby code:

class MyController
  def do_foo a, b
    puts a, b

I've tried googleing the problem but I can't find any good tutorials.

Any help?
Posted via http://www.ruby-forum.com/.
Ironruby-core mailing list
Ironruby-core at rubyforge.org

More information about the Ironruby-core mailing list