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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With