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:


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

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

  yield(self)
  force_flush
end

Instance Method Details

#flushObject


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

def flush
  # Ignore flush for the moment
end

#write(value) ⇒ Object


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

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