[Ironruby-core] Accessing a Module's Classes from C# with dynamic

Will Green will at hotgazpacho.org
Sat Jan 15 07:58:09 EST 2011

On Jan 15, 2011, at 2:55 AM, Joshua M. wrote:

> No matter what I do I can only access RbScriptApp and not Foo if I call
> Runtime.UseFile("global.rb"). So far I have two other work arounds: 1.)
> create wrapper methods for everything I want to access in app.rb (ugh),
> or 2.) use Engine.Execute("RbScriptApp::Foo.new"). The latter is more
> preferrable, I suppose, but it seems strange that I can't access Foo by
> dynamic.

That's how Modules work in Ruby. Just like namespaces in C#.

Try adding 

include RbScriptApp

to your global.rb file. You need to include the Module if you want to access the class without qualifying it.

> Any more information about this issue would be very helpful and
> appreciated.
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core

Will Green
will at hotgazpacho.org

More information about the Ironruby-core mailing list