11件ヒット
[1-11件を表示]
(0.078秒)
別のキーワード
検索結果
-
Object
# respond _ to?(name , include _ all = false) -> bool (18219.0) -
オブジェクトがメソッド name を持つとき真を返します。
...ach{|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 start
puts "start"
end
def template_metho......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言語...