I am trying the code below:
class A
def initialize foo = nil
super
end
end
A.new
When I run it, it raises an error wrong number of arguments (1 for 0)
at the super
line. Why does this raise an error? I haven't passed any argument to new
or super
, and am not sure why. If I omit the optional argument signature foo = nil
, the error goes away.
The code above with super
might not make much sense, but in actual use, A
is a subclass of Hash
, and I have a block passed to super
.