Jay Levitt wrote:
> Start with:
> 
> class C
>   def self.class_callme
>     internal_helper
>   end
> 
>   def instance_callme
>     C.internal_helper
>   end
> 
>   def self.internal_helper
>     puts "I'm not needed by the outside world."
>   end
> end
> 
> My first instinct was to make internal_helper protected:
> 
> class << self
>   protected
>     def internal_helper
>       puts "I'm not needed by the outside world."
>     end
> end
> 
> However, instance_methods (such as instance_callme) can't call protected
> class methods.  
> 
> Is there some other idiomatic Ruby way to, er, protect internal_helper, or
> another way to call it from instance_callme?  Or do I just have to do it
> through lack of documentation with :nodoc:, as Rails seems to do?
> 
> Jay Levitt

Why not just stick internal_helper in a nested module? (Or does 
internal_helper need to access class state?)

class C
   def self.class_callme
     M.internal_helper
   end

   def instance_callme
     M.internal_helper
   end

   module M
     def self.internal_helper
       puts "I'm not needed by the outside world."
     end
   end
end

C.new.instance_callme  # ==> I'm not needed by the outside world.

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407