Hiding block parameter from super method

Hi,

sorry if this is too much of a FAQ, but I couldn’t find a quick
answer, so hopefully somebody here can help me out.

class A def initialize(&block) yield if(block_given?) end end

class B < A
def initialize(&block)
super()
@block=block
end
end

B.new {|| puts “Duh!”}

How would I hide the block parameter from A’s initialize method?

The ‘real problem’ is that I am working with a subclass of
Fox::FXDialogBox that receives a block parameter on initialization.
Unfortunately that block gets executed during the super initialization
call. Of course I can resort to using a Proc instance instead of a
block in my subclass, but I’d still like to now…

Regards,
Patrick

Patrick Roemer wrote:

How would I hide the block parameter from A’s initialize method?

Easy…

super(&nil)

Hi,

Joel VanderWerf wrote:

How would I hide the block parameter from A’s initialize method?

Easy…

super(&nil)

Duh! So I’ve been tackled by the principle of least surprise once
again. :wink:

Thanks a lot for the quick answer.

Regards,
Patrick