Module: RunKit::CoreExt::Enumerator
- Defined in:
- lib/run_kit/core_ext.rb
Overview
each.with_progresbar
Instance Method Summary collapse
Instance Method Details
#with_progressbar(options = {}, &block) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/run_kit/core_ext.rb', line 36 def ( = {}, &block) defaults = { format: "%j%% %B #{RunKit::Term.paint_ansi("%c/%u %e", RunKit::Term.ansi256_fg(242))}", progress_mark: RunKit::Term.paint_ansi("━", RunKit::Term.ansi256_fg(46)), remainder_mark: RunKit::Term.paint_ansi("━", RunKit::Term.ansi256_fg(237)), output: $stdout.isatty ? $stdout : $stderr, total: size, length: 72, } = defaults.merge() return enum_for(__method__) if !block if ![:hide] = ProgressBar.create() end RunKit::Term.with_hidden_cursor([:output]) do each do &.increment yield(_1) end end end |