Hi,

At Tue, 16 Nov 2004 12:13:51 +0900,
Zach Dennis wrote in [ruby-talk:120510]:
> I am curious how I can capture a block that was passed. Here's what I'm 
> trying to do:
> 
> class BaseClass
> 	def initialize( arg1 )
> 		puts "got a block" if block_given?
> 	end
> end
> 
> class SubBaseClass < BaseClass
> 	def initialize( arg1 , arg2 )
> 		super( arg1 )
> 	end
> end
> 
> sbc = SubBaseClass.new( "aarg1" , "arg2" ) { puts "my block" }
> 
> 
> I would like BaseClass to receive the block I passed to the SubBaseClass 
>   constructor. I have tried a few variations, but nothing went.

Your code prints "got a block".  "super" passes the given block
to the super class'es method, unless called with &nil.

# Please stop posting by replying to irrelevant threads.
# Otherwise I sometimes tend to miss new threads you posted.

-- 
Nobu Nakada