Class: ProgressStream
- Inherits:
-
Object
- Object
- ProgressStream
- Defined in:
- lib/rvc/util.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#len ⇒ Object
readonly
Returns the value of attribute len.
Instance Method Summary collapse
-
#initialize(io, len, &b) ⇒ ProgressStream
constructor
A new instance of ProgressStream.
- #read(n) ⇒ Object
Constructor Details
#initialize(io, len, &b) ⇒ ProgressStream
Returns a new instance of ProgressStream.
408 409 410 411 412 413 |
# File 'lib/rvc/util.rb', line 408 def initialize io, len, &b @io = io @len = len @count = 0 @cb = b end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
406 407 408 |
# File 'lib/rvc/util.rb', line 406 def count @count end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
406 407 408 |
# File 'lib/rvc/util.rb', line 406 def io @io end |
#len ⇒ Object (readonly)
Returns the value of attribute len.
406 407 408 |
# File 'lib/rvc/util.rb', line 406 def len @len end |
Instance Method Details
#read(n) ⇒ Object
415 416 417 418 419 420 |
# File 'lib/rvc/util.rb', line 415 def read n io.read(n).tap do |c| @count += c.length if c @cb[self] end end |