def pausable
        begin
          halted = !catch(:halt) { yield; true }
        rescue Exception => error
          raise unless @resume_block
        end
        
        if @resume_block
          @resume_block.call(halted, error)
        else
          halted
        end
      end
def pausable
        begin
          halted = !catch(:halt) { yield; true }
        rescue Exception => error
          raise unless @resume_block
        end
        
        if @resume_block
          @resume_block.call(halted, error)
        else
          halted
        end
      end
Runs a block that may get paused.  If the block doesn't pause, then
 execution will continue as normal.  If the block gets paused, then it
 will take care of switching the execution context when it's resumed.

 This will return true if the given block halts for a reason other than
 getting paused.