Class: Gemlings::UI::StatusLine
- Inherits:
-
Object
- Object
- Gemlings::UI::StatusLine
- Defined in:
- lib/gemlings/ui.rb
Instance Method Summary collapse
- #error!(text) ⇒ Object
-
#initialize(message) ⇒ StatusLine
constructor
A new instance of StatusLine.
- #start ⇒ Object
- #success!(text) ⇒ Object
Constructor Details
#initialize(message) ⇒ StatusLine
Returns a new instance of StatusLine.
114 115 116 117 118 |
# File 'lib/gemlings/ui.rb', line 114 def initialize() @message = @running = false @frame = 0 end |
Instance Method Details
#error!(text) ⇒ Object
141 142 143 144 |
# File 'lib/gemlings/ui.rb', line 141 def error!(text) finish! puts Styles.error_dot.render("● ") + Styles.error.render("Error: ") + text end |
#start ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/gemlings/ui.rb', line 120 def start @running = true @thread = Thread.new do while @running char = SPINNER_FRAMES[@frame % SPINNER_FRAMES.size] styled = Styles.spinner_style.render(char) print "\r\e[K#{styled} #{Styles.dim.render(@message)}" $stdout.flush @frame += 1 sleep 0.08 end end self end |