Class: DRb::WebSocket::StrStream
- Inherits:
-
Object
- Object
- DRb::WebSocket::StrStream
- Defined in:
- lib/opal/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.
139 140 141 |
# File 'lib/opal/drb/websocket.rb', line 139 def initialize(str='') @buf = str end |
Instance Attribute Details
#buf ⇒ Object (readonly)
Returns the value of attribute buf.
142 143 144 |
# File 'lib/opal/drb/websocket.rb', line 142 def buf @buf end |
Instance Method Details
#read(n) ⇒ Object
144 145 146 147 148 149 150 |
# File 'lib/opal/drb/websocket.rb', line 144 def read(n) begin return @buf[0,n] ensure @buf = @buf[n, @buf.size - n] end end |
#write(s) ⇒ Object
152 153 154 |
# File 'lib/opal/drb/websocket.rb', line 152 def write(s) @buf += s end |