るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

Object#respond_to_missing?(symbol, include_private) -> bool (18136.0)

自身が symbol で表されるメソッドに対し BasicObject#method_missing で反応するつもりならば真を返します。

...*args)
if name =~ /^to_*/
[name, *args] # => [:to_sample, "sample args1", "sample args2"]
return
else
super
end
end

def respond_to_missing?(sym, include_private)
(sym =~ /^to_*/) ? true : super
end
end

s = Sample.new
s.to_sample("sample args1", "sample args2...