Class: Gem::StreamUI::ThreadedDownloadReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/user_interaction.rb

Overview

A progress reporter that behaves nicely with threaded downloading.

Constant Summary collapse

MUTEX =
Mutex.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(out_stream, *args) ⇒ ThreadedDownloadReporter

Creates a new threaded download reporter that will display on out_stream. The other arguments are ignored.



576
577
578
579
# File 'lib/rubygems/user_interaction.rb', line 576

def initialize(out_stream, *args)
  @file_name = nil
  @out = out_stream
end

Instance Attribute Details

#file_nameObject (readonly)

The current file name being displayed



570
571
572
# File 'lib/rubygems/user_interaction.rb', line 570

def file_name
  @file_name
end

Instance Method Details

#doneObject

Indicates the download is complete.



602
603
604
# File 'lib/rubygems/user_interaction.rb', line 602

def done
  # Do nothing.
end

#fetch(file_name, *args) ⇒ Object

Tells the download reporter that the file_name is being fetched. The other arguments are ignored.



585
586
587
588
589
590
# File 'lib/rubygems/user_interaction.rb', line 585

def fetch(file_name, *args)
  if @file_name.nil?
    @file_name = file_name
    locked_puts "Fetching #{@file_name}"
  end
end

#update(bytes) ⇒ Object

Updates the threaded download reporter for the given number of bytes.



595
596
597
# File 'lib/rubygems/user_interaction.rb', line 595

def update(bytes)
  # Do nothing.
end