Reputation: 683
I found this in a Module that is supposed to extend some other class:
module Somemodule
def foo(*)
do_something_funny
super
end
end
I understand def foo(*args)
construct. What is the purpose of an asterisk alone?
Upvotes: 2
Views: 202
Reputation: 6068
It's similar to *args
but you get no reference to the arguments. They are, however, passed as provided to any super
invocation to the parent's constructor (or same-name method), as long as no explicit parameters are specified in the super
call.
It is a nice way to convey that you do not intend to process the provided arguments in any way.
Upvotes: 11