Class: EventProgressPrinter
- Inherits:
-
Object
- Object
- EventProgressPrinter
- Defined in:
- lib/ods_helper.rb
Overview
Print events progress
Constant Summary collapse
- SPINNER =
['/', '-', '\\', '|']
- STARTED =
'started'- SUCCESS =
'success'- FAILURE =
'failure'
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(output: $stdout) ⇒ EventProgressPrinter
constructor
A new instance of EventProgressPrinter.
- #print_event(name, state, context = nil) ⇒ Object
Constructor Details
#initialize(output: $stdout) ⇒ EventProgressPrinter
Returns a new instance of EventProgressPrinter.
552 553 554 555 556 557 558 559 |
# File 'lib/ods_helper.rb', line 552 def initialize(output: $stdout) @output = output @spinner_index = 0 @spinner_thread = nil @current_line = nil @transient_lines = 0 @mutex = Mutex.new end |
Instance Method Details
#close ⇒ Object
576 577 578 579 580 |
# File 'lib/ods_helper.rb', line 576 def close stop_spinner clear_transient if interactive? show_cursor if interactive? end |
#print_event(name, state, context = nil) ⇒ Object
561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
# File 'lib/ods_helper.rb', line 561 def print_event(name, state, context = nil) return if name.nil? || name.to_s.empty? state = state.to_s stop_spinner clear_transient if interactive? if state == STARTED print_active_event(name, state, context) else print_event_line(name, state, context) end end |