Class: Tros::IPC::FramedWriter
- Inherits:
-
Object
- Object
- Tros::IPC::FramedWriter
- Defined in:
- lib/tros/ipc.rb
Instance Attribute Summary collapse
-
#writer ⇒ Object
readonly
Returns the value of attribute writer.
Instance Method Summary collapse
-
#initialize(writer) ⇒ FramedWriter
constructor
A new instance of FramedWriter.
- #to_s ⇒ Object
- #write_framed_message(message) ⇒ Object
Constructor Details
#initialize(writer) ⇒ FramedWriter
Returns a new instance of FramedWriter.
465 466 467 |
# File 'lib/tros/ipc.rb', line 465 def initialize(writer) @writer = writer end |
Instance Attribute Details
#writer ⇒ Object (readonly)
Returns the value of attribute writer.
464 465 466 |
# File 'lib/tros/ipc.rb', line 464 def writer @writer end |
Instance Method Details
#to_s ⇒ Object
484 |
# File 'lib/tros/ipc.rb', line 484 def to_s; writer.string; end |
#write_framed_message(message) ⇒ Object
469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'lib/tros/ipc.rb', line 469 def () = .size total_bytes_sent = 0 while - total_bytes_sent > 0 if - total_bytes_sent > BUFFER_SIZE buffer_size = BUFFER_SIZE else buffer_size = - total_bytes_sent end write_buffer([total_bytes_sent, buffer_size]) total_bytes_sent += buffer_size end write_buffer_size(0) end |