Sha256: 92d16540420609bb41378b461f48e79bd6af235af05629d35a6de0713b5609e0
Contents?: true
Size: 705 Bytes
Versions: 1
Compression:
Stored size: 705 Bytes
Contents
class Shoes class Download def initialize app, name, args, &blk require 'open-uri' Thread.new do open name, content_length_proc: lambda{|len| @content_length, @started = len, true}, progress_proc: lambda{|size| @progress = size} do |sio| open(args[:save], 'wb'){|fw| fw.print sio.read} if args[:save] @finished, @sio = true, sio end end a = app.animate 10, args[:repaint] do (a.stop; blk[@sio]) if @finished end if blk end attr_reader :progress, :content_length def started? @started end def finished? @finished end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
purple_shoes-0.7.166 | lib/shoes/download.rb |