Class: ProgressStream

Inherits:
Object
  • Object
show all
Defined in:
lib/rvc/util.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io, len, &b) ⇒ ProgressStream

Returns a new instance of ProgressStream.



428
429
430
431
432
433
# File 'lib/rvc/util.rb', line 428

def initialize io, len, &b
  @io = io
  @len = len
  @count = 0
  @cb = b
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



426
427
428
# File 'lib/rvc/util.rb', line 426

def count
  @count
end

#ioObject (readonly)

Returns the value of attribute io.



426
427
428
# File 'lib/rvc/util.rb', line 426

def io
  @io
end

#lenObject (readonly)

Returns the value of attribute len.



426
427
428
# File 'lib/rvc/util.rb', line 426

def len
  @len
end

Instance Method Details

#read(n) ⇒ Object



435
436
437
438
439
440
# File 'lib/rvc/util.rb', line 435

def read n
  io.read(n).tap do |c|
    @count += c.length if c
    @cb[self]
  end
end