Hello anyone!
I want to use IronRuby as scripting language (as Lua, for example) in my .net project. For example, I want to be able to subscribe from ruby script to specific events, fired in host application, and call ruby methods from it.
I'm using this code for instantiate IronRuby engine:
Dim engine = Ruby.CreateEngine()
Dim source = engine.CreateScriptSourceFromFile("index.rb").Compile()
' Execute it
source.Execute()
Supposing index.rb contains:
subscribe("ButtonClick", handler)
def handler
puts "Hello there"
end
How do I:
- Set C# method Subscribe (defined in host application) visible from index.rb?
- Invoke later handler method from host application?
Thanks a lot!