def a puts "a" end def b puts "b" end def f a yield ensure b end f do puts "inner" end cc = nil f do callcc { |s| cc = s } end cc.call # #a