[ruby-talk:02585] Re: Eat prefixing _ with names?

From: Dave Thomas <Dave@...>
Date: 2000-04-26 23:24:25 UTC
List: ruby-talk #2585
mrilu <mrilu@ale.cx> writes:

> Is there any idea to define _Foo to be as good class name as Foo? 
> Maybe this could be accomplished by stripping leading _ before 
> determining name applicability for class/method/constant/module/variable.

Ruby defines an underscore to be a lowercase letter, so this would
cause problems.

> Came up with this when tried to use some _C_code with this common, 
> yet ugly, prefixing idiom. I think one should provide clean interface Foo
> which calls _Foo_in_ugly_c. 

You could do this for yourself by adding 'method_missing' to your
target class, and simply reissuing the call after stripping the
leading underscore. You could make this behavior a module and mix it
in to classes you wanted to behave this way.


Regards


Dave

In This Thread