Forum: IronRuby Lowercase classname

9bc73a477811a9578b3c526bbe567f3d?d=identicon&s=25 Tinco Andringa (Guest)
on 2010-11-18 15:44
(Received via mailing list)
Hey guys,

I'm using IronRuby to interface with a clr library. There is a small
problem however: It has one class that does not start with a capital
letter. This causes IronRuby to just not see the class since ruby does
not support lowercase constantnames. Does anyone know if it's possible
to work around this in IronRuby (like somehow getting a reference to
it with a string, and then assigning it to different ruby constant)?
Or should I make my own clr dll that exposes the class with a
different (uppercased) name?

Cheers,
Tinco Andringa (simkor.nl)
9bc73a477811a9578b3c526bbe567f3d?d=identicon&s=25 Tinco Andringa (Guest)
on 2010-11-19 00:20
(Received via mailing list)
Hmm I've found the documentation for IronRuby now :P It says class
names should automatically be capitalized. This however seems not to
have happened since it plainly isn't available. I have worked around
the issue by renaming it in the source, but this forces me to ship
precompiled dll's instead of referencing the other framework.

Should I file a bugreport? This is on the 1.1.1 release :)

Cheers,
Tinco
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2010-11-19 01:31
(Received via mailing list)
This might be a bug in the documentation :-)? Method names are mangled
so that you can use foo_bar  to call FooBar method.

You should be able to use const_get(:foo) to get to the constant.

Tomas
9bc73a477811a9578b3c526bbe567f3d?d=identicon&s=25 Tinco Andringa (Guest)
on 2010-11-19 14:40
(Received via mailing list)
Hey Tomas,

Thanks for the reply. const_get :foo also raises the constants should
begin with an uppercase letter error :)

Object.const_get :foo
(ir):1:in `const_get': `foo' is not allowed as a constant name
(NameError)
        from (ir):1

Cheers,
Tinco

On Fri, Nov 19, 2010 at 00:32, Tomas Matousek
F0f461459193aa098a80bd3e74e0ac9c?d=identicon&s=25 Shay Friedman (shayfriedman)
on 2010-11-19 14:43
(Received via mailing list)
637f25ef9ecc971bdeeb05c533f36b60?d=identicon&s=25 Andrius Bentkus (Guest)
on 2010-11-19 16:10
(Received via mailing list)
On Fri, Nov 19, 2010 at 2:41 PM, Shay Friedman
<shay.friedman@gmail.com>wrote:

> Look here:
>
http://www.ironshay.com/post/Working-with-NET-Lowe...
>
<http://www.ironshay.com/post/Working-with-NET-Lowe...
> Shay.
>

Excellent solution. I mean, really, all the C# classes should start with
an
uppercase letter, thats basically a standard, therefore this should be
the
only solution and I don't see no need to actually hack this otherwise
into
IronRuby.
This topic is locked and can not be replied to.