Class: Gamefic::User::Buffer
- Inherits:
-
Object
- Object
- Gamefic::User::Buffer
- Defined in:
- lib/gamefic/user/buffer.rb
Overview
A simple buffer class for collecting and returning data received from plots.
Instance Method Summary collapse
-
#flush ⇒ String
Get the current data and clear the buffer.
-
#initialize ⇒ Buffer
constructor
A new instance of Buffer.
-
#send(message) ⇒ Object
Append a message to the buffer.
Constructor Details
#initialize ⇒ Buffer
Returns a new instance of Buffer.
6 7 8 |
# File 'lib/gamefic/user/buffer.rb', line 6 def initialize @data = '' end |
Instance Method Details
#flush ⇒ String
Get the current data and clear the buffer.
18 19 20 21 22 |
# File 'lib/gamefic/user/buffer.rb', line 18 def flush tmp = @data @data = '' tmp end |
#send(message) ⇒ Object
Append a message to the buffer.
11 12 13 |
# File 'lib/gamefic/user/buffer.rb', line 11 def send @data += end |