るりまサーチ

最速Rubyリファレンスマニュアル検索!
1039件ヒット [1001-1039件を表示] (0.120秒)

別のキーワード

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

クラス

検索結果

<< < ... 9 10 11 >>

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

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

...lic に変更します。

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

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

@
return self を返します。

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

# => 非公開...
...nerClass
end

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

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

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

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

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

@
see Module#private_constant...

Module#public_method_defined?(name, inherit=true) -> bool (49.0)

インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が public であるときに true を返します。 そうでなければ false を返します。

...うでなければ false を返します。

@
param name Symbol か String を指定します。
@
param inherit 真を指定するとスーパークラスや include したモジュールで
定義されたメソッドも対象になります。

@
see Module#method_defined?, Module#private_me...
...thod_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module A
def method1() end
end
class
B
protected
def method2() end
end
class
C < B
include A
def method3() end
end

A.method_defined? :method1 #=> true
C.public_method_defined? "method1" #=> tr...

Module#const_defined?(name, inherit = true) -> bool (43.0)

モジュールに name で指定される名前の定数が定義されている時真 を返します。

...することができます。

@
param name String, Symbol で指定される定数名。

@
param inherit false を指定するとスーパークラスや include したモジュールで
定義された定数は対象にはなりません。

//emlist[例][ruby]{
module Kernel
FOO = 1
end...
...true を返す
p Object.const_defined?(:FOO) # => true

module Bar
BAR = 1
end
class
Object
include Bar
end
# ユーザ定義のモジュールに対しても同様
p Object.const_defined?(:BAR) # => true

class
Baz
include Bar
end
# Object 以外でも同様になった
# 第二引数の...

Object#public_method(name) -> Method (43.0)

オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。

...返します。

@
param name メソッド名を Symbol または String で指定します。
@
raise NameError 定義されていないメソッド名や、
protected メソッド名、 private メソッド名を引数として与えると発生します。

//emlist[][ruby]{
1.public_method(...
...:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}

@
see Object#method,Object#public_send,Module#public_instance_method...
<< < ... 9 10 11 >>