Method: Mockingbird::Commands::Pipe#run

Defined in:
lib/mockingbird/commands.rb

#run(conn) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/mockingbird/commands.rb', line 108

def run(conn)
  unless io.eof?
    chunk = io.readline
    conn.send_chunk(chunk)
    if delay
      EM.add_timer(delay) { run(conn) }
    else
      EM.schedule { run(conn) }
    end
  else
    # Reset for future calls
    io.rewind
    advance(conn)
  end
end