Class: Infopark::UserIO::Progress
- Inherits:
-
Object
- Object
- Infopark::UserIO::Progress
- Defined in:
- lib/infopark/user_io.rb
Instance Method Summary collapse
- #finish ⇒ Object
- #increment ⇒ Object
-
#initialize(label, user_io) ⇒ Progress
constructor
A new instance of Progress.
- #start ⇒ Object
Constructor Details
#initialize(label, user_io) ⇒ Progress
Returns a new instance of Progress.
16 17 18 19 |
# File 'lib/infopark/user_io.rb', line 16 def initialize(label, user_io) @label = label @user_io = user_io end |
Instance Method Details
#finish ⇒ Object
33 34 35 36 37 38 |
# File 'lib/infopark/user_io.rb', line 33 def finish if @started user_io.tell("… ", newline: false) user_io.tell("OK", color: :green, bright: true) end end |
#increment ⇒ Object
28 29 30 31 |
# File 'lib/infopark/user_io.rb', line 28 def increment raise ImplementationError, "progress not started yet" unless @started user_io.tell(".", newline: false) end |
#start ⇒ Object
21 22 23 24 25 26 |
# File 'lib/infopark/user_io.rb', line 21 def start unless @started user_io.tell("#{label} ", newline: false) @started = true end end |