获取脚本文件中的所有方法
执行此代码后:
var runtime = IronRuby.Ruby.CreateRuntime();
var engine = IronRuby.Ruby.CreateEngine();
var scrope = engine.CreateScope();
engine.ExecuteFile("libtest.rb");
如何在 C# 代码中获取 ruby 类的所有方法?
After executing this code:
var runtime = IronRuby.Ruby.CreateRuntime();
var engine = IronRuby.Ruby.CreateEngine();
var scrope = engine.CreateScope();
engine.ExecuteFile("libtest.rb");
How can I get all the methods of a ruby class in c# code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
或者您可以从 C# http://github .com/casualjim/ironrubymvc/blob/master/IronRubyMvc/Core/RubyEngine.cs#L178
如果您定义方法但没有将它们放在类中,则应将它们添加到 Object 类中
Or you can do it from C# http://github.com/casualjim/ironrubymvc/blob/master/IronRubyMvc/Core/RubyEngine.cs#L178
If you define methods without having them in a class they should get added to the Object class
我还没有弄清楚所有事情,但这是一个开始:
请原谅我的风格,我实际上并不了解 C#。
这是我的 libtest.rb:
这是输出:
I haven't figured everything out yet, but here's a start:
Forgive my style, I don't actually know C#.
This is my
libtest.rb
:And this is the output: