36件ヒット
[1-36件を表示]
(0.046秒)
別のキーワード
検索結果
先頭3件
-
Object
# respond _ to?(name , include _ all = false) -> bool (18213.0) -
オブジェクトがメソッド name を持つとき真を返します。
...されていない場合は、Object#respond_to_missing? を呼
び出してその結果を返します。
@param name Symbol または文字列で指定するメソッド名です。
@param include_all private メソッドと protected メソッドを確認の対象に
含め......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
template_method......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言語... -
Delegator
# respond _ to?(m) -> bool (18207.0) -
Delegator#__getobj__ が返すオブジェクトが メソッド m を持つとき真を返します。
...Delegator#__getobj__ が返すオブジェクトが メソッド m を持つとき真を返します。
@param m メソッド名
@see Object#respond_to?... -
WIN32OLE
# ole _ respond _ to?(name) -> bool (6207.0) -
指定したメソッドをオブジェクトがサポートしているか調べます。
...ません。
@param name 調べるメソッド名を文字列またはシンボルで指定します。
@return nameで指定したメソッドをオブジェクトが提供していれば真を返します。
excel = WIN32OLE.new('Excel.Application')
excel.ole_respond_to?(:quit) #=> true...