[Ironruby-core] Accessing classes defined in IronRuby.dll from within IronRuby (IronRuby 1.0RC1)

Tomas Matousek Tomas.Matousek at microsoft.com
Mon Jan 18 01:23:49 EST 2010

IronRuby is a module already defined in standard library. It gives you access to a bunch of useful APIs, including name mangling:

>>> IronRuby.singleton_methods
=> ["configuration", "globals", "load", "loaded_assemblies", "loaded_scripts", "require", 'create_runtime', 'create_engine', 'create_ruby_setup', 'get_engine', 'require_file', 'get_execution_context']
>>> IronRuby.constants
=> ["Clr", "Print"]
>>> IronRuby::Clr.constants
=> ["BigInteger", "FlagEnumeration", "Float", "Integer", "MultiDimensionalArray", "String", "Name", "Scope"]
>>> IronRuby::Clr::Name.singleton_methods(false)
=> ["clr_to_ruby", "mangle", "ruby_to_clr", "unmangle"]
>>> include IronRuby::Clr
>>> Name.mangle("FooBar")
=> "foo_bar"
>>> Name.unmangle("my_foo")
=> "MyFoo"

Re loading IronRuby.dll - the problem is that IronRuby is also a namespace in IronRuby.dll so there is a name conflict we don't probably handle the best we could. Loading IronRuby.dll shouldn't be a common scenario though. The best place for IronRuby specific functionality is in the IronRuby module. If you're missing some let us know.


From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Orion Edwards
Sent: Sunday, January 17, 2010 8:29 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Accessing classes defined in IronRuby.dll from within IronRuby (IronRuby 1.0RC1)

I am doing load_assembly 'IronRuby', and it didn't work (the example is copy/pasted pretty much verbatim). Not sure if that means your version of IR is different to mine, or what?

On Mon, Jan 18, 2010 at 3:56 PM, Jimmy Schementi <Jimmy.Schementi at microsoft.com<mailto:Jimmy.Schementi at microsoft.com>> wrote:
load_assembly 'IronRuby' will do the trick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100118/1aa5b24b/attachment-0001.html>

More information about the Ironruby-core mailing list