7

I was poking through the Rails 3 ActiveRecord source code today and found a method where the entire parameter list was a single asterisk.

def save(*)

I couldn't find a good description of what this does (though I have some ideas based on what I know about splat arguments).

What does it do, and why would you use it?

Craig Walker
  • 49,871
  • 54
  • 152
  • 212
  • I really like [this explanation](http://stackoverflow.com/questions/918449/what-is-the-operator-doing-to-this-string-in-ruby/918475#918475) of the splat operator. – rdvdijk Sep 23 '11 at 16:40

1 Answers1

9

It means it can have any number of arguments (including zero) and it discards all those arguments.

Karoly Horvath
  • 94,607
  • 11
  • 117
  • 176