Class: Web::Connection::BufferSet
Instance Method Summary collapse
-
#initialize ⇒ BufferSet
constructor
A new instance of BufferSet.
- #last ⇒ Object
- #ob_clean ⇒ Object
- #ob_end_clean ⇒ Object
- #ob_end_flush ⇒ Object
- #ob_flush ⇒ Object
- #ob_get_clean ⇒ Object
- #ob_get_contents ⇒ Object
- #ob_get_length ⇒ Object
- #ob_get_level ⇒ Object
- #ob_list_handlers ⇒ Object
- #ob_start(&callback) ⇒ Object
Constructor Details
#initialize ⇒ BufferSet
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
#last ⇒ Object
374 375 376 |
# File 'lib/web/connection.rb', line 374 def last @buffer_stack.last end |
#ob_clean ⇒ Object
378 379 380 |
# File 'lib/web/connection.rb', line 378 def ob_clean last.clean end |
#ob_end_clean ⇒ Object
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_flush ⇒ Object
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_flush ⇒ Object
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_clean ⇒ Object
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_contents ⇒ Object
395 396 397 |
# File 'lib/web/connection.rb', line 395 def ob_get_contents @buffer_stack.last.get_contents end |
#ob_get_length ⇒ Object
415 416 417 |
# File 'lib/web/connection.rb', line 415 def ob_get_length ob_get_contents.length end |
#ob_get_level ⇒ Object
370 371 372 |
# File 'lib/web/connection.rb', line 370 def ob_get_level @buffer_stack.length end |
#ob_list_handlers ⇒ Object
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 |