Stefan Achatz said:
> Hello,
> I'm glad to get so well founded help here, so here's another beginner
> question:
> Trying to make a singleton method private I tried this:
>
> class MyClass
>   def MyClass.class_private
>   end
>
>   def private
>   end
>
>   private :private
>   private :MyClass::class_private
> end
>
> The nomenclature of the singleton method doesn't make it.
> What's the right naming?

irb(main):001:0> class MyClass
irb(main):002:1> def self.bar
irb(main):003:2> p 'bar'
irb(main):004:2> end
irb(main):005:1> end
=> nil
irb(main):006:0> MyClass.bar
"bar"
=> nil
irb(main):007:0> class MyClass
irb(main):008:1> class << self
irb(main):009:2> private :bar
irb(main):010:2> end
irb(main):011:1> end
=> #<Class:MyClass>
irb(main):012:0> MyClass.bar
NoMethodError: private method `bar' called for MyClass:Class
        from (irb):12
irb(main):013:0>

So to summarize the above, you need to go inside the singleton class for
MyClass to make any singleton methods private.

Ryan