Sha256: c82c395681a79b5f33fb539438e4725ea90b392581f668aac39adc703ec6eb70
Contents?: true
Size: 651 Bytes
Versions: 1
Compression:
Stored size: 651 Bytes
Contents
# frozen_string_literal: true require "ruby-progressbar" class Kraaken::Logger < ActiveSupport::Logger def initialize super Kraaken::Logger::LogDevice.new(-> { @progress_bar }) @painter = Kraaken::Logger::Color.new self.formatter = Kraaken::Logger::Formatter.new(@painter) end def with_progress(total:, title: nil, &block) @progress_bar = ProgressBar.create( total:, title:, format: "%t |#{color("%B", color: :blue)}|" ) block.call @progress_bar.finish @progress_bar = nil end def increment_progress(by: 1) @progress_bar&.progress += by end delegate :color, to: :@painter end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kraaken-0.0.1 | lib/kraaken/logger.rb |