class Infobar
def busy(frames: :circle1, **opts, &block)
def busy(frames: :circle1, **opts, &block) block_given? or raise ArgumentError, 'block is required as an argument' duration = opts.delete(:sleep) || 0.1 reset call(**opts | { total: Float::INFINITY, message: { format: ' %l %te %s ', '%s' => { frames: frames } }, }) ib = Thread.new { loop do +infobar sleep duration end } r = nil t = Thread.new { r = yield } t.join ib.kill r end