--- !ruby/object:RI::ClassDescription 
attributes: []

class_methods: []

comment: 
- !ruby/struct:SM::Flow::P 
  body: This module is used to extend sockets and other IO objects, to allow them to be buffered for both read and write. This abstraction makes it quite easy to write a select-based event loop (see Net::SSH::Connection::Session#listen_to).
- !ruby/struct:SM::Flow::P 
  body: "The general idea is that instead of calling #read directly on an IO that has been extended with this module, you call #fill (to add pending input to the internal read buffer), and then #read_available (to read from that buffer). Likewise, you don't call #write directly, you call #enqueue to add data to the write buffer, and then #send_pending or #wait_for_pending_sends to actually send the data across the wire."
- !ruby/struct:SM::Flow::P 
  body: "In this way you can easily use the object as an argument to IO.select, calling #fill when it is available for read, or #send_pending when it is available for write, and then call #enqueue and #read_available during the idle times."
- !ruby/struct:SM::Flow::VERB 
  body: "  socket = TCPSocket.new(address, port)\n  socket.extend(Net::SSH::BufferedIo)\n\n  ssh.listen_to(socket)\n\n  ssh.loop do\n    if socket.available &gt; 0\n      puts socket.read_available\n      socket.enqueue(&quot;response\\n&quot;)\n    end\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: "Note that this module must be used to extend an instance, and should not be included in a class. If you do want to use it via an include, then you must make sure to invoke the private #initialize_buffered_io method in your class' #initialize method:"
- !ruby/struct:SM::Flow::VERB 
  body: "  class Foo &lt; IO\n    include Net::SSH::BufferedIo\n\n    def initialize\n      initialize_buffered_io\n      # ...\n    end\n  end\n"
constants: []

full_name: Net::SSH::BufferedIo
includes: 
- !ruby/object:RI::IncludedModule 
  name: Loggable
instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: available
- !ruby/object:RI::MethodSummary 
  name: enqueue
- !ruby/object:RI::MethodSummary 
  name: fill
- !ruby/object:RI::MethodSummary 
  name: pending_write?
- !ruby/object:RI::MethodSummary 
  name: read_available
- !ruby/object:RI::MethodSummary 
  name: send_pending
- !ruby/object:RI::MethodSummary 
  name: wait_for_pending_sends
name: BufferedIo
superclass: 
