1.9.2p290 :001 > def test
1.9.2p290 :002?> if block_given?
1.9.2p290 :003?> puts “I have a block”
1.9.2p290 :004?> yield
1.9.2p290 :005?> else
1.9.2p290 :006 > puts “no block”
1.9.2p290 :007?> end
1.9.2p290 :008?> end
=> nil
1.9.2p290 :011 > def other &blk
1.9.2p290 :012?> puts “passing block”
1.9.2p290 :013?> test &blk
1.9.2p290 :014?> end
=> nil
1.9.2p290 :015 > other
passing block
no block
=> nil
1.9.2p290 :018 > other {puts “I’m the block”}
passing block
I have a block
I’m the block
=> nil