るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.124秒)
トップページ > クエリ:@[x] > クエリ:r[x] > クラス:Object[x] > クエリ:respond_to?[x]

別のキーワード

  1. win32ole ole_respond_to?
  2. object respond_to?
  3. _builtin respond_to?
  4. delegator respond_to?
  5. delegate respond_to?

ライブラリ

検索結果

Object#respond_to?(name, include_all = false) -> bool (24219.0)

オブジェクトがメソッド name を持つとき真を返します。

...きることをいいます。

Windows での Process.fork や GNU/Linux での File.lchmod の
ような NotImplementedError が発生する場合は false を返します。

※ NotImplementedError が発生する場合に false を返すのは
R
ubyの組み込みライブラリや標準ライ...
...メソッドのみです。
R
ubyで実装されたメソッドで NotImplementedError が発生する場合は true を返します。

メソッドが定義されていない場合は、Object#respond_to_missing? を呼
び出してその結果を返します。

@
param name Symbol または文字...
...ist[][ruby]{
class F
def hello
"Bonjour"
end
end

class D
private
def hello
"Guten Tag"
end
end
list = [F.new,D.new]

list.each{|it| puts it.hello if it.respond_to?(:hello)}
#=> Bonjour

list.each{|it| it.instance_eval("puts hello if it.respond_to?(:hello, true)")}
#=> Bonjour
#...