Ruby - Passing Arguments to the Superclass

Introduction

If the argument list is empty and no parentheses are used, all arguments are passed to the superclass.

But if the argument list is empty and parentheses are used, no arguments are passed to the superclass:

# This passes a, b, c to the superclass 
def initialize( a, b, c, d, e, f ) 
   super( a, b, c ) 
end 

# This passes a, b, c to the superclass 
def initialize( a, b, c ) 
   super 
end 

# This passes no arguments to the superclass 
def initialize( a, b, c) 
   super() 
end 

Related Topic