るりまサーチ

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

別のキーワード

  1. _builtin eval
  2. kernel eval
  3. module class_eval
  4. module module_eval
  5. _builtin class_eval

ライブラリ

クラス

検索結果

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

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

...o_missing? を呼
び出してその結果を返します。

@param name Symbol または文字列で指定するメソッド名です。

@param include_all private メソッドと protected メソッドを確認の対象に
含めるかを true か false で指定します。...
...llo
"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
# Guten Tag

module Template
def main
start
template_method
finish
end...
...mentedError.new
end

def finish
puts "finish"
end
end

class ImplTemplateMethod
include
Template
def template_method
"implement template_method"
end
end

class NotImplTemplateMethod
include
Template

# not implement template_method
end

puts ImplTemplateMethod.new.respond_to?...