What does the * symbol do near a function argument and how to use that in others scenarios?
- by user502052
I am using Ruby on Rails 3 and I would like to know what means the presence of a *simbol near a function argument and to understand its usages in others scenarios.
Example scenario (this method was from the Ruby on Rails 3 framework:
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