Sha256: 8fba0c143e23117c20d8570107ee58248cb86b0857dc137df66d25c573abc999
Contents?: true
Size: 611 Bytes
Versions: 41
Compression:
Stored size: 611 Bytes
Contents
class Shoes class Download def initialize 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] blk[sio] if blk @finished = true end end end attr_reader :progress, :content_length def started? @started end def finished? @finished end end end
Version data entries
41 entries across 41 versions & 1 rubygems