Hi,
This is my first post here so if this is not the correct mailing list, I
apologize in advance.
I am using the version 0.9 dlls to host IronRuby in a C# app (using Vista64
and C# Express 2008)
Everything is work as expected except when I tried to access top level
variables and methods in the C# app.
If I run the following code through Ruby and IronRuby on the command line, I
get the expected result, an array
["initialize", "testFoo", "testBar"] and the value of @expose
def testFoo
"foo"
end
def testBar
"bar"
end
@expose = %w(testFoo testBar)
puts instance_variable_get("@expose")
p_m = private_methods(false)
puts p_m.inspect
But when I try to do the same access through the ScriptEngine, the private
methods array contains only 'initialize'
and the instance variable remains null.
ScriptEngine engine = Ruby.CreateEngine();
engine.ExecuteFile(file);
var code = "private_methods(false)";
var privates =
engine.CreateScriptSourceFromString(code).Execute();
var code2 = "method :instance_variable_get";
var action =
engine.CreateScriptSourceFromString(code2).Execute();
var result = engine.Operations.Call(action, "@expose");
Any ideas on where I am messing up or what I am missing?
Thanks,
David Blackmon
(The broader context of what I am doing is here
http://github.com/davidbl/IronRuby-Autocad-Helper/tree/master
Overall, everything is working, but I would like to access the top-level
methods so that I can have them exposed as Autocad commands and any methods
not on the top-level would be not be exposed to the Autocad command-line)
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core