Class: Core::Io::Buffer

Inherits:
Object
  • Object
show all
Defined in:
app/api/core/io/buffer.rb

Instance Method Summary collapse

Constructor Details

#initialize(stream) {|_self| ... } ⇒ Buffer

Returns a new instance of Buffer.

Yields:

  • (_self)

Yield Parameters:



3
4
5
6
7
8
9
# File 'app/api/core/io/buffer.rb', line 3

def initialize(stream)
  @stream, @buffer = stream, StringIO.new
  return unless block_given?

  yield(self)
  force_flush
end

Instance Method Details

#flushObject



16
17
18
# File 'app/api/core/io/buffer.rb', line 16

def flush
  # Ignore flush for the moment
end

#write(value) ⇒ Object



11
12
13
14
# File 'app/api/core/io/buffer.rb', line 11

def write(value)
  @buffer.write(value)
  force_flush if @buffer.string.length > configatron.api.flush_response_at
end