るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.073秒)
トップページ > クエリ:Ruby[x] > 種類:インスタンスメソッド[x] > クエリ:@[x] > クエリ:ruby[x] > クエリ:end[x] > クエリ:begin[x] > クエリ:public_constant[x]

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rubygems/defaults ruby_engine
  5. rake ruby

ライブラリ

クラス

検索結果

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

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

...に変更します。

@
param name 0 個以上の String か Symbol を指定します。

@
raise NameError 存在しない定数を指定した場合に発生します。

@
return self を返します。

//emlist[例][ruby]{
module SampleModule
class SampleInnerClass
end


# => 非公開ク...
...ass
end


begin

SampleModule::SampleInnerClass
rescue => e
e # => #<NameError: private constant SampleModule::SampleInnerClass referenced>
end


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


S...
...ampleModule::SampleInnerClass # => SampleModule::SampleInnerClass
//}

@
see Module#private_constant, Object#untrusted?...
...ampleModule::SampleInnerClass # => SampleModule::SampleInnerClass
//}

@
see Module#private_constant...