class Qiniu2Upyun::Data

Attributes

bar[R]
io[R]

Public Class Methods

new(io, bar) click to toggle source
# File lib/qiniu2upyun/data.rb, line 5
def initialize(io, bar)
  @io  = io
  @bar = bar
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source
# File lib/qiniu2upyun/data.rb, line 30
def method_missing(method, *args, &block)
  io.send(method)
end
read(*args, &block) click to toggle source
# File lib/qiniu2upyun/data.rb, line 10
def read(*args, &block)
  result = io.read(*args, &block)

  length = args.last.length

  length > 0 ?  bar.progress += length : bar.finish

  result
end
write(*args, &block) click to toggle source
# File lib/qiniu2upyun/data.rb, line 20
def write(*args, &block)
  result = io.write(*args, &block)

  bar.progress += result

  bar.finish if bar.total == io.length

  result
end