るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.040秒)
トップページ > クエリ:ruby[x] > クエリ:method[x] > クエリ:instance_eval[x] > クラス:Object[x]

別のキーワード

  1. _builtin define_method
  2. irb/input-method new
  3. irb/input-method gets
  4. irb/input-method encoding
  5. irb/input-method readable_atfer_eof?

ライブラリ

検索結果

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

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

...
Ruby
の組み込みライブラリや標準ライブラリなど、C言語で実装されているメソッドのみです。
Ruby
で実装されたメソッドで NotImplementedError が発生する場合は true を返します。

メソッドが定義されていない場合は、Object#resp...
...事になります。

//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?(:hell...
...start
template_method
finish
end

def start
puts "start"
end

def template_method
raise NotImplementedError.new
end

def finish
puts "finish"
end
end

class ImplTemplateMethod
include Template
def template_method
"implement template_method"
end
end

class...