private_constant(*name) -> selfRuby 1.9.3 から[permalink][rdoc][edit]-
name で指定した定数の可視性を private に変更します。
- [PARAM]
name: - 0 個以上の String か Symbol を指定します。
- [EXCEPTION]
NameError: - 存在しない定数を指定した場合に発生します。
- [RETURN]
- self を返します。
[SEE_ALSO] Module#public_constant
例module Api VERSION = '1.0' class Client; end SECRET = 'token' class Internal; end private_constant :SECRET private_constant :Internal end p Api::VERSION # => "1.0" p Api::Client # => Api::Client Api::SECRET # ~> NameError: private constant Api::SECRET referenced Api::Internal # ~> NameError: private constant Api::Internal referenced - [PARAM]