How to I make private class constants in Ruby
        Posted  
        
            by DMisener
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by DMisener
        
        
        
        Published on 2010-05-20T13:02:08Z
        Indexed on 
            2010/05/20
            13:20 UTC
        
        
        Read the original article
        Hit count: 183
        
ruby
|class-constants
In Ruby how does one create a private class constant? (i.e one that is visible inside the class but not outside)
class Person
  SECRET='xxx' # How to make class private??
  def show_secret
    puts "Secret: #{SECRET}"
  end
end
Person.new.show_secret puts Person::SECRET # I'd like this to fail
© Stack Overflow or respective owner