Skip to content

Instantly share code, notes, and snippets.

@victorarias
Created August 10, 2013 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victorarias/6198945 to your computer and use it in GitHub Desktop.
Save victorarias/6198945 to your computer and use it in GitHub Desktop.
class Connection
# .. rest of the class .. #
def accept_connection(io)
@io = io
# new connection code
end
def to_io
@io
end
end
class Reactor
# array_of_connections_to_read is an array of instances of the above Connection class
# array_of_connections_to_write is an array of instances of the above Connection class
def tick
to_read, to_write = IO.select(array_of_connections_to_read, array_of_connections_to_write)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment