るりまサーチ (Ruby 2.1.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.032秒)
トップページ > ライブラリ:ビルトイン[x] > バージョン:2.1.0[x] > クエリ:@[x] > クエリ:begin[x] > クラス:Module[x]

別のキーワード

  1. _builtin begin
  2. range begin
  3. matchdata begin
  4. arithmeticsequence begin
  5. begin

検索結果

Module#public_constant(*name) -> self (100.0)

name で指定した定数の可視性を public に変更します。

...][ruby]{
module
SampleModule
class SampleInnerClass
end

# => 非公開クラスであることを明示するために private にする
private_constant :SampleInnerClass
end

begin
SampleModule::SampleInnerClass
rescue => e
e # => #<NameError: private constant SampleModule::SampleInne...
...rClass referenced>
end

module
SampleModule
# => 非公開クラスであることは承知で利用するために public にする
public_constant :SampleInnerClass
end

SampleModule::SampleInnerClass # => SampleModule::SampleInnerClass
//}

@see Module#private_constant, Object#untrusted?...