Module: Backport::Server::Connectable
Overview
A mixin for Backport servers that communicate with clients.
Connectable servers check clients for incoming data on each tick.
Instance Method Summary collapse
Instance Method Details
#clients ⇒ Array<Client>
24 25 26 |
# File 'lib/backport/server/connectable.rb', line 24 def clients @clients ||= [] end |
#starting ⇒ Object
15 16 17 |
# File 'lib/backport/server/connectable.rb', line 15 def starting clients.map(&:run) end |
#stopping ⇒ Object
19 20 21 |
# File 'lib/backport/server/connectable.rb', line 19 def stopping clients.map(&:stop) end |
#tick ⇒ Object
8 9 10 11 12 13 |
# File 'lib/backport/server/connectable.rb', line 8 def tick clients.each do |client| input = client.read client.sending input unless input.nil? end end |