Class: Web::Connection::BufferSet

Inherits:
Object
  • Object
show all
Defined in:
lib/web/connection.rb

Instance Method Summary collapse

Constructor Details

#initializeBufferSet

Returns a new instance of BufferSet.



361
362
363
364
# File 'lib/web/connection.rb', line 361

def initialize
  @buffer_stack = [ ]
  @buffer_stack.push CallbackBuffer.new
end

Instance Method Details

#lastObject



374
375
376
# File 'lib/web/connection.rb', line 374

def last
  @buffer_stack.last
end

#ob_cleanObject



378
379
380
# File 'lib/web/connection.rb', line 378

def ob_clean
  last.clean
end

#ob_end_cleanObject



382
383
384
385
386
387
# File 'lib/web/connection.rb', line 382

def ob_end_clean
  unless @buffer_stack.empty?
    @buffer_stack.pop
    true
  end
end

#ob_end_flushObject



409
410
411
412
413
# File 'lib/web/connection.rb', line 409

def ob_end_flush
  result = ob_flush
  ob_end_clean
  result
end

#ob_flushObject



399
400
401
402
403
404
405
406
407
# File 'lib/web/connection.rb', line 399

def ob_flush
  result = nil
  @buffer_stack.reverse.each do |b|
    b << result if result
    result = b.flush
  end
  #@buffer_stack = [ CallbackBuffer.new ]
  result
end

#ob_get_cleanObject



389
390
391
392
393
# File 'lib/web/connection.rb', line 389

def ob_get_clean
  unless @buffer_stack.empty?
    @buffer_stack.pop.get_contents
  end
end

#ob_get_contentsObject



395
396
397
# File 'lib/web/connection.rb', line 395

def ob_get_contents
  @buffer_stack.last.get_contents
end

#ob_get_lengthObject



415
416
417
# File 'lib/web/connection.rb', line 415

def ob_get_length
  ob_get_contents.length
end

#ob_get_levelObject



370
371
372
# File 'lib/web/connection.rb', line 370

def ob_get_level
  @buffer_stack.length
end

#ob_list_handlersObject



366
367
368
# File 'lib/web/connection.rb', line 366

def ob_list_handlers
  @buffer_stack
end

#ob_start(&callback) ⇒ Object



419
420
421
# File 'lib/web/connection.rb', line 419

def ob_start( &callback )
  @buffer_stack.push( CallbackBuffer.new(&callback) )
end