るりまサーチ

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

別のキーワード

  1. argf.class lines
  2. argf.class each_line
  3. argf.class each
  4. argf.class readline
  5. argf.class readlines

ライブラリ

クラス

検索結果

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

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

...きることをいいます。

Windows での Process.fork や GNU/Linux での File.lchmod の
ような NotImplementedError が発生する場合は false を返します。

※ NotImplementedError が発生する場合に false を返すのは
Rubyの組み込みライブラリや標準ライ...
...aram include_all private メソッドと protected メソッドを確認の対象に
含めるかを true か false で指定します。省略した場合
は false(含めない) を指定した事になります。

//emlist[][ruby]{
class
F
def hello
"B...
...onjour"
end
end

class
D
private
def hello
"Guten Tag"
end
end
l
ist = [F.new,D.new]

l
ist.each{|it| puts it.hello if it.respond_to?(:hello)}
#=> Bonjour

l
ist.each{|it| it.instance_eval("puts hello if it.respond_to?(:hello, true)")}
#=> Bonjour
# Guten Tag

module
Template
def main...