lib/capissh/sessions.rb
def process_iteration(wait=nil, &block)
      ensure_each_session { |session| session.preprocess }

      return false if block && !block.call(self)

      readers = @sessions.map { |session| session.listeners.keys }.flatten.reject { |io| io.closed? }
      writers = readers.select { |io| io.respond_to?(:pending_write?) && io.pending_write? }

      if readers.any? || writers.any?
        readers, writers, = IO.select(readers, writers, nil, wait)
      end

      if readers
        ensure_each_session do |session|
          ios = session.listeners.keys
          session.postprocess(ios & readers, ios & writers)
        end
      end

      true
    end
# perform ssh session looping with reading/writing until the block returns false
perform ssh session looping with reading/writing until the block returns false
perform ssh session looping with reading / writing until the block returns false
def process_iteration(wait=nil, &block)
      ensure_each_session { |session| session.preprocess }
      return false if block && !block.call(self)
      readers = @sessions.map { |session| session.listeners.keys }.flatten.reject { |io| io.closed? }
      writers = readers.select { |io| io.respond_to?(:pending_write?) && io.pending_write? }
      if readers.any? || writers.any?
        readers, writers, = IO.select(readers, writers, nil, wait)
      end
      if readers
        ensure_each_session do |session|
          ios = session.listeners.keys
          session.postprocess(ios & readers, ios & writers)
        end
      end
      true
    end
def process_iteration ( wait = nil , & block ) ensure_each_session { | session | session . preprocess } return false if block && ! block . call ( self ) readers = @sessions . map { | session | session . listeners . keys } . flatten . reject { | io | io . closed? } writers = readers . select { | io | io . respond_to? ( :pending_write? ) && io . pending_write? } if readers . any? || writers . any? readers , writers , = IO . select ( readers , writers , nil , wait ) end if readers ensure_each_session do | session | ios = session . listeners . keys session . postprocess ( ios & readers , ios & writers ) end end true end
perform ssh session looping with reading/writing until the block returns false
perform ssh session looping with reading / writing until the block returns false
wait
block