Class: ProgressStream
- Inherits:
-
Object
- Object
- ProgressStream
- Defined in:
- lib/rvc/modules/datastore.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.
105 106 107 108 109 110 |
# File 'lib/rvc/modules/datastore.rb', line 105 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.
103 104 105 |
# File 'lib/rvc/modules/datastore.rb', line 103 def count @count end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
103 104 105 |
# File 'lib/rvc/modules/datastore.rb', line 103 def io @io end |
#len ⇒ Object (readonly)
Returns the value of attribute len.
103 104 105 |
# File 'lib/rvc/modules/datastore.rb', line 103 def len @len end |
Instance Method Details
#read(n) ⇒ Object
112 113 114 115 116 117 |
# File 'lib/rvc/modules/datastore.rb', line 112 def read n io.read(n).tap do |c| @count += c.length if c @cb[self] end end |