Class: Muxr::Application::FramedOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/muxr/application.rb

Overview

Renderer expects an IO-ish sink with #write and #flush. We frame every write as one OUTPUT message on the attached client; nobody attached = bytes go nowhere (and Application skips render entirely in that case, so this path is rarely exercised).

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ FramedOutput

Returns a new instance of FramedOutput.



1036
1037
1038
# File 'lib/muxr/application.rb', line 1036

def initialize(app)
  @app = app
end

Instance Method Details

#flushObject



1045
1046
1047
# File 'lib/muxr/application.rb', line 1045

def flush
  # Unix sockets do not need a Ruby-level flush.
end

#write(bytes) ⇒ Object



1040
1041
1042
1043
# File 'lib/muxr/application.rb', line 1040

def write(bytes)
  @app.deliver_output(bytes)
  bytes.bytesize
end