# Looking for more information on rubifying C# classes

**URL:** <https://www.ruby-forum.com/t/looking-for-more-information-on-rubifying-c-classes/182486>\
**Category:** IronRuby\
**Created:** [January 28, 2010, 8:53pm UTC](https://www.ruby-forum.com/t/looking-for-more-information-on-rubifying-c-classes/182486 "2010-01-28T20:53:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Burmister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@Adam\_Burmister](https://www.ruby-forum.com/u/Adam_Burmister)\
**Post date:** [January 28, 2010, 8:53pm UTC](https://www.ruby-forum.com/t/looking-for-more-information-on-rubifying-c-classes/182486/1 "2010-01-28T20:53:57Z")

</div>

Hello IronRubyists,

I’m currently hunting around trying to find references on rubifying a C#  
class for something I’m writing.

I have a few questions:

- Can you confirm this summary of the process to be correct (am I  
missing any steps):  
The generate class intialiser exe parses the attributes out and  
generates the initializer file. Then you recompile the library with the  
added initializer class included.  
When using load\_assembly you pass in the name of the initializer class  
name as the second parameter.  
Under the covers that initializer tells IronRuby how to create the  
ruby API.

- Is there any documentation for the Ruby\* attributes? (RubyMethod,  
RubyConstant, etc)  
I can easily guess at what these are/do, but I just wanted to know if  
there is a definitive source.

- What are the differences between require and load\_assembly (besides  
load\_assembly loading the file on every call)

Any answers or comments would be greatly appreciated.

Thank you,  
Adam Burmister

---

<div class="post-metadata">

**Author:** ![Adam\_Burmister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@Adam\_Burmister](https://www.ruby-forum.com/u/Adam_Burmister)\
**Post date:** [January 28, 2010, 9:18pm UTC](https://www.ruby-forum.com/t/looking-for-more-information-on-rubifying-c-classes/182486/2 "2010-01-28T21:18:32Z")

</div>

The steps sound correct.

The attributes are pretty easy to understand if you search for existing  
uses. The harder part is how to declare the arguments with annotations  
for Ruby semantics.  
[http://wiki.github.com/ironruby/ironruby/modifying-the-sources](http://wiki.github.com/ironruby/ironruby/modifying-the-sources) has some  
info. Please add to it if you can.

Could you provide info about why you need to Rubyify your C# class?  
IronRuby already exposes a Rubified view for all .NET classes (for  
example, allowing you to use “lower\_case” names for methods)? You need  
to rubyify your code mainly if you want strict Ruby semantics as is  
needed by the builtin library types.

load\_assembly is just more explicit. See  
[http://ironruby.net/Documentation/.NET/Assemblies](http://ironruby.net/Documentation/.NET/Assemblies). load\_assembly does  
not load the assembly on every call as .NET does not support reloading  
an assembly multiple times. Perhaps it should have been called  
require\_assembly…

---

<div class="post-metadata">

**Author:** ![Adam\_Burmister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@Adam\_Burmister](https://www.ruby-forum.com/u/Adam_Burmister)\
**Post date:** [January 28, 2010, 9:54pm UTC](https://www.ruby-forum.com/t/looking-for-more-information-on-rubifying-c-classes/182486/3 "2010-01-28T21:54:14Z")

</div>

Also, load\_assembly calls the library initializers if called with a  
second argument which is the namespace within the assembly to look in  
for the attributes (RubyMethod, RubyConstant, etc). See  
Merlin\Main\Languages\Ruby\Libs\thread.rb as an example for this usage  
of load\_library.

---

<div class="post-metadata">

**Author:** ![Adam\_Burmister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@Adam\_Burmister](https://www.ruby-forum.com/u/Adam_Burmister)\
**Post date:** [February 1, 2010, 9:40pm UTC](https://www.ruby-forum.com/t/looking-for-more-information-on-rubifying-c-classes/182486/4 "2010-02-01T21:40:32Z")

</div>

Tomas has updated [http://ironruby.net/Documentation/.NET/Assemblies](http://ironruby.net/Documentation/.NET/Assemblies).  
Thanks for the good info, Tomas
