るりまサーチ

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

別のキーワード

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

ライブラリ

検索結果

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

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

...されたメソッドで NotImplementedError が発生する場合は true を返します。

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

@param name Symbol または文字列で指定するメソッド名です。...
...uten 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
# Guten Tag

module
Template
def main
start
template_method
finish
end

def st...
...t implement template_method
end

puts ImplTemplateMethod.new.respond_to?(:template_method) # => true
# NotImplementedError が発生しているが、Rubyによる実装部のため true を返す
puts NotImplTemplateMethod.new.respond_to?(:template_method) # => true
# GNU/Linux で実行。C言語...