るりまサーチ

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

別のキーワード

  1. csv instance
  2. syslog instance
  3. prime instance
  4. _builtin instance_eval
  5. singleton instance

ライブラリ

クラス

検索結果

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

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

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

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

※ NotImplementedError が発生する場合に false を返すのは
Rubyの組み込みライブラリや標準ライ...
...false(含めない) を指定した事になります。

//emlist[][ruby]{
class F
def hello
"Bonjour"
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(...
...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_method
raise NotImplementedError.new
end

def finish
puts "finish"
end
end

class ImplTempla...

irb/completion (6072.0)

irb の completion 機能を提供するライブラリです。

...irb の completion 機能を提供するライブラリです。

=== 使い方

$ irb -r irb/completion

とするか, ~/.irbrc 中に

require "irb/completion"

を入れてください.
irb実行中に require "irb/completion" してもよいです.

irb 実行中に [Tab] を押すとコ...
...):001:0> in
in inspect instance_eval
include install_alias_method instance_of?
initialize install_aliases instance_variables
irb(main):001:0> inspect
"main"
irb(main):002:0> foo = Object.new
#<Object:0x4027146c>

"変...
...ッド一覧がでます.

irb(main):003:0> foo.
foo.== foo.frozen? foo.protected_methods
foo.=== foo.hash foo.public_methods
foo.=~ foo.id foo.respond_to?
foo.__id__ foo.inspect...