Class: Gem::StreamUI::SimpleProgressReporter

Inherits:
Object
  • Object
show all
Includes:
DefaultUserInteraction
Defined in:
lib/build-tool/GUI.rb

Overview

A basic dotted progress reporter.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DefaultUserInteraction

ui, #ui, ui=, #ui=, use_ui, #use_ui

Constructor Details

#initialize(out_stream, size, initial_message, terminal_message = "complete") ⇒ SimpleProgressReporter

Returns a new instance of SimpleProgressReporter.



277
278
279
280
281
282
283
284
285
# File 'lib/build-tool/GUI.rb', line 277

def initialize(out_stream, size, initial_message,
               terminal_message = "complete")
  @out = out_stream
  @total = size
  @count = 0
  @terminal_message = terminal_message

  @out.puts initial_message
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



275
276
277
# File 'lib/build-tool/GUI.rb', line 275

def count
  @count
end

Instance Method Details

#doneObject

Prints out the terminal message.



299
300
301
# File 'lib/build-tool/GUI.rb', line 299

def done
  @out.puts "\n#{@terminal_message}"
end

#updated(message) ⇒ Object

Prints out a dot and ignores message.



290
291
292
293
294
# File 'lib/build-tool/GUI.rb', line 290

def updated(message)
  @count += 1
  @out.print "."
  @out.flush
end