私はRubyonRails 3を使用していますが*
、関数の引数の近くに演算子が存在することの意味を知り、他のシナリオでの使用法を理解したいと思います。
シナリオ例(このメソッドはRuby on Rails 3フレームワークからのものです):
def find(*args)
return to_a.find { |*block_args| yield(*block_args) } if block_given?
options = args.extract_options!
if options.present?
apply_finder_options(options).find(*args)
else
case args.first
when :first, :last, :all
send(args.first)
else
find_with_ids(*args)
end
end
end