class Gem::StreamUI::ThreadedDownloadReporter
一个用于线程下载的进度报告器,行为良好。
常量
- MUTEX
属性
当前正在显示的文件名
公共类方法
源代码
# File lib/rubygems/user_interaction.rb, line 553 def initialize(out_stream, *args) @file_name = nil @out = out_stream end
创建一个新的线程下载报告器,它将在 out_stream
上显示。其他参数将被忽略。
公共实例方法
源代码
# File lib/rubygems/user_interaction.rb, line 562 def fetch(file_name, *args) if @file_name.nil? @file_name = file_name locked_puts "Fetching #{@file_name}" end end
告知下载报告器正在获取 file_name
。其他参数将被忽略。
源代码
# File lib/rubygems/user_interaction.rb, line 572 def update(bytes) # Do nothing. end
用给定的 bytes
数更新线程下载报告器。
私有实例方法
源代码
# File lib/rubygems/user_interaction.rb, line 585 def locked_puts(message) MUTEX.synchronize do @out.puts message end end