Class: SafeUpdate::Presenter
- Inherits:
-
Object
- Object
- SafeUpdate::Presenter
- Includes:
- Curses
- Defined in:
- lib/safe_update/presenter.rb
Constant Summary collapse
- SPINNER_STATES =
outdated_gems is an array of instances of SafeUpdate::OutdatedGem
['|', '/', '-', '\\']
Instance Method Summary collapse
- #call(outdated_gems) ⇒ Object
-
#initialize ⇒ Presenter
constructor
A new instance of Presenter.
- #stop ⇒ Object
Constructor Details
#initialize ⇒ Presenter
Returns a new instance of Presenter.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/safe_update/presenter.rb', line 11 def initialize Curses.noecho Curses.init_screen Curses.start_color Curses.init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK) Curses.init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK) Curses.init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK) Curses.init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK) @tick = 1 @running = true end |
Instance Method Details
#call(outdated_gems) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/safe_update/presenter.rb', line 24 def call(outdated_gems) @outdated_gems = outdated_gems while @running do @tick += 1 update_screen sleep 0.3 end end |
#stop ⇒ Object
33 34 35 36 |
# File 'lib/safe_update/presenter.rb', line 33 def stop @running = false print_final_output end |