Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does a single splat/asterisk in a Ruby argument list mean? [duplicate]

Tags:

ruby

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?

like image 879
Craig Walker Avatar asked Sep 23 '11 16:09

Craig Walker


1 Answers

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

like image 57
Karoly Horvath Avatar answered Sep 19 '22 01:09

Karoly Horvath