On Thu, Jul 30, 2009 at 1:19 PM, Robert Dober<robert.dober / gmail.com> wrote:
> On Thu, Jul 30, 2009 at 9:00 PM, Matt Neuburg<matt_neuburg / tidbits.com> wrote:
>> Venkat Akkineni <venkatram.akkineni / gmail.com> wrote:
>>
>>> Hi
>>>
>>> How would one create a method that is accessible from
>>> outside but avoid the subclass from overriding and changing the
>>> definition?
>>
>> Something like this?
>>
>> class Superclass
>>   >>  
>>   
>>  ½ 
>>     >>  >>  
>>  
>> end
>>
>> That doesn't really prevent the programmer from working his will, but
>> then in Ruby *nothing*
> with the exception of freeze, but that is not applicable here as
> frozen classes can be subclassed without any problem and would be too
> radical anyway.
> But I thought if noteworthy that frozen objects and closures cannot be
> "cracked" in Ruby.

An interesting little experiment I played a while ago regarding frozen
classes and modules.

http://gist.github.com/82025

Does not address the original poster's question, but it might spur
some other creative thinking. One addition to this gist would be the
creation of an "inherited" method in the frozen class that would
subsequently freeze any class that tries to inherit from this.
Essentially this would make the class "un-inheritable" since
subclasses should not define any new methods.

Blessings,
TwP