Supernil

When calling super in Ruby without arguments, you expect all arguments being passed to the superclass method. If you want to pass your own arguments, you just put them there. If you don’t want to pass any arguments, you need to put empty braces after the super call:

super()

So far nothing new. Now imagine a block being passed to your subclass method, and you don’t want the superclass method to receive it. In this case putting an empty argument list isn’t enough. You need to clear the block by explicitly passing nil as a block argument

super(&nil) 

Leave a Reply

Your email address will not be published. Required fields are marked *