11件ヒット
[1-11件を表示]
(0.098秒)
検索結果
-
Object
# respond _ to?(name , include _ all = false) -> bool (18278.0) -
オブジェクトがメソッド name を持つとき真を返します。
...クトが メソッド name に応答できることをいいます。
Windows での Process.fork や GNU/Linux での File.lchmod の
ような NotImplementedError が発生する場合は false を返します。
※ NotImplementedError が発生する場合に false を返すのは
Rubyの組......rivate メソッドと protected メソッドを確認の対象に
含めるかを true か false で指定します。省略した場合
は false(含めない) を指定した事になります。
//emlist[][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
# Guten Tag
module Template
def main
start
templ...