Class: RubyProgress::Worm
- Inherits:
-
Object
- Object
- RubyProgress::Worm
- Includes:
- WormRunner
- Defined in:
- lib/ruby-progress/worm.rb
Overview
Animated progress indicator with ripple effect using Unicode combining characters
Constant Summary collapse
- RIPPLE_STYLES =
Ripple effect styles
{ 'circles' => { baseline: '·', # middle dot midline: '●', # black circle peak: '⬤' # large circle }, 'blocks' => { baseline: '▁', # lower eighth block midline: '▄', # lower half block peak: '█' # full block }, 'geometric' => { baseline: '▪', # small black square midline: '▫', # small white square peak: '■' # large black square }, 'cirlces_small' => { baseline: '∙', midline: '∙', peak: '●' }, 'arrow' => { baseline: '▹', midline: '▸', peak: '▶' }, 'balloon' => { baseline: '.', midline: 'o', peak: '°' }, 'circle_open' => { baseline: '○', midline: '●', peak: '○' } }.freeze
- SPEED_MAP =
Speed mappings
{ 'slow' => 0.5, 'medium' => 0.2, 'fast' => 0.1 }.freeze
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Worm
constructor
A new instance of Worm.
Methods included from WormRunner
#animate, #animation_loop, #animation_loop_daemon_mode, #animation_loop_step, #run_daemon_mode, #run_indefinitely, #run_with_command, #stop
Constructor Details
#initialize(options = {}) ⇒ Worm
Returns a new instance of Worm.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/ruby-progress/worm.rb', line 58 def initialize( = {}) @length = [:length] || 3 @message = [:message] @speed = parse_speed([:speed] || 'medium') @style = parse_style([:style] || 'circles') @command = [:command] @success_text = [:success] @error_text = [:error] @show_checkmark = [:checkmark] || false @output_stdout = [:stdout] || false @output_lines = [:output_lines] @output_position = [:output_position] @output_live = [:stdout_live] || false @direction_mode = [:direction] || :bidirectional @start_chars, @end_chars = RubyProgress::Utils.parse_ends([:ends]) @running = false end |