[rspec-users] class << self considered harmful... really?

Scott Taylor mailing_lists at railsnewbie.com
Tue Nov 25 13:39:55 EST 2008


On Nov 25, 2008, at 1:27 PM, Wes Gamble wrote:

> Scott Taylor wrote
>>>
>>> I'd be interested, however, in hearing about the benefits of  
>>> opening the eigenclass to define class methods (apart from ease in  
>>> searching, which may be best handled with ctags).
>>
>> Grouping and private methods.
> Potentially dumb question:
>
> As far as private class methods, could you do
>
> private
> def self.blah
>   ...
> end
>
> to get private class methods, or does private not work on class  
> methods in this way?

You'll have to open the metaclass:

http://gist.github.com/29021

Scott


More information about the rspec-users mailing list