Project

General

Profile

Feature #17171

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

```ruby 
 class Foo 
   def call_me 
     # ... 
   end 

   private 
 
   SOME_DATA = %i[...].freeze    # is public, why not private? 

   def calc_stuff    # is private, ok. 
     # ... 
   end 
 end 
 ``` ```ruby 

 It's probably a naive question, but why shouldn't `SOME_DATA`'s visibility be private? 

 When writing gems, more often than not the constants that I write are not meant for public consumption. I find it redundant (and tiresome) to explicitly write `private_constant :SOME_DATA`.

Back