Class: DRb::WebSocket::StrStream
- Inherits:
-
Object
- Object
- DRb::WebSocket::StrStream
- Defined in:
- lib/drb/websocket.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.
8 9 10 |
# File 'lib/drb/websocket.rb', line 8 def initialize(str='') @buf = str end |
Instance Attribute Details
#buf ⇒ Object (readonly)
Returns the value of attribute buf.
11 12 13 |
# File 'lib/drb/websocket.rb', line 11 def buf @buf end |
Instance Method Details
#read(n) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/drb/websocket.rb', line 13 def read(n) begin return @buf[0,n] ensure @buf[0,n] = '' end end |
#write(s) ⇒ Object
21 22 23 |
# File 'lib/drb/websocket.rb', line 21 def write(s) @buf.concat s end |