Class: DRb::HTTP0::StrStream
- Inherits:
-
Object
- Object
- DRb::HTTP0::StrStream
- Defined in:
- lib/drb/http0.rb
Instance Attribute Summary collapse
-
#buf ⇒ Object
readonly
Returns the value of attribute buf.
Instance Method Summary collapse
-
#initialize(str = '') ⇒ StrStream
constructor
A new instance of StrStream.
- #read(n) ⇒ Object
- #write(s) ⇒ Object
Constructor Details
#initialize(str = '') ⇒ StrStream
Returns a new instance of StrStream.
10 11 12 |
# File 'lib/drb/http0.rb', line 10 def initialize(str='') @buf = str end |
Instance Attribute Details
#buf ⇒ Object (readonly)
Returns the value of attribute buf.
13 14 15 |
# File 'lib/drb/http0.rb', line 13 def buf @buf end |
Instance Method Details
#read(n) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/drb/http0.rb', line 15 def read(n) begin return @buf[0,n] ensure @buf[0,n] = '' end end |
#write(s) ⇒ Object
23 24 25 |
# File 'lib/drb/http0.rb', line 23 def write(s) @buf.concat s end |