Hi,

On Thu, Jan 7, 2016 at 9:08 AM, Jon Rowe <m...@jonrowe.co.uk> wrote:
>  I’ve never seen `private_class_method def self.class_method_name` in the 
> wild I suspect that it only works by accident…

I believe it works because `def method_name` returns :method_name as a
symbol, and private_class_method takes a method name symbol as its
argument.

Eaden

On Thu, Jan 7, 2016 at 9:08 AM, Jon Rowe <m...@jonrowe.co.uk> wrote:
> `private` and `private_class_method` aren’t just keywords, they take
> arguments e.g.
>
> private :method_name
> private_class_method :class_method_name
>
> that will work consistently… I’ve never seen `private_class_method def
> self.class_method_name` in the wild I suspect that it only works by
> accident…
>
> Jon Rowe
> ---------------------------
> m...@jonrowe.co.uk
> jonrowe.co.uk
>
> On Thursday, 7 January 2016 at 19:47, Ravi (Tom) Hale wrote:
>
> I'm trying to wrap my head around this seeming inconsistency.
>
> Tested with Ruby 2.2.3
>
> On a line by itself
> -------------------
> private - makes all following definitions private
> private_class_method - *does nothing* - following methods are still
> available publicly
>
> On the same line as a method definition
> ---------------------------------------
> private - fails: `private def self.priv`: test.rb:32:in `private':
> undefined method `priv' for class `Self' (NameError)
> private_class_method - works (with def self.methodname)
>
> Can anyone help out?
>
> If you too think it is worth reporting to the ruby developers, how would
> I best go about informing them?
>
> Cheers,
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rails-oceania+unsubscr...@googlegroups.com.
> To post to this group, send email to rails-oceania@googlegroups.com.
> Visit this group at https://groups.google.com/group/rails-oceania.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rails-oceania+unsubscr...@googlegroups.com.
> To post to this group, send email to rails-oceania@googlegroups.com.
> Visit this group at https://groups.google.com/group/rails-oceania.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rails-oceania+unsubscr...@googlegroups.com.
To post to this group, send email to rails-oceania@googlegroups.com.
Visit this group at https://groups.google.com/group/rails-oceania.
For more options, visit https://groups.google.com/d/optout.

Reply via email to