执行以下的代码给我,下列例外,在最后一行:

InvalidOperationException:"未结合变量:值"

var rubyRuntime = Ruby.CreateRuntime();
rubyRuntime.UseFile("HandleMoveRequested.rb");
var engine = rubyRuntime.GetEngine("rb");
dynamic ruby = engine.Runtime.Globals;

var handler = ruby.HandleMoveRequested.@new();

dynamic msg = new ExpandoObject();
msg.x = 1;
msg.y = 2;

handler.handle(msg);

内容HandleMoveRequested.rb:

class HandleMoveRequested
    def handle(msg)
        System::Console.WriteLine msg.x
        System::Console.WriteLine msg.y
    end
end

基本上我只是希望能够通过一个完全动态的物体进入红宝石对象的"处理"方法,已能够访问"x"和"y"的属性,对象。我叫了错误的树吗?

有帮助吗?

解决方案

我测试你的代码(为)后,建立最新的来源:http://github.com/ironruby/ironruby

请试试这个。我想像的修正将包含在下一RC建立(RC3?) 和以后。
当你建立从来源, 确保你建立的"V4释放"建立一个使用Ruby4.sln

编辑: 测试我自己,这个工作没有问题中最新的

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top