Sha256: 18d430cfd939a10727b6a70b70a6566ac972b5e2c4b4328b5166249eb09c8361

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

module Gamefic

  # A simple buffer class for collecting and returning data received from
  # plots.
  class User::Buffer
    def initialize
      @data = ''
    end

    # Append a message to the buffer.
    def send message
      @data += message
    end

    # Read the current buffer without clearing it.
    #
    # @return [String]
    def peek
      @data
    end

    # Get the current data and clear the buffer.
    #
    # @return [String]
    def flush
      tmp = @data
      @data = ''
      tmp
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamefic-1.6.0 lib/gamefic/user/buffer.rb