Sha256: 6493ae2f65c5ad1ba2ba1f6fa33916ce181a875af7ff16b384a96b37ba12a6bb
Contents?: true
Size: 666 Bytes
Versions: 1
Compression:
Stored size: 666 Bytes
Contents
module Backport module Server # A mixin for Backport servers that communicate with clients. # # Connectable servers check clients for incoming data on each tick. # module Connectable def tick mutex.synchronize do clients.each(&:tick) clients.delete_if(&:stopped?) end end def starting clients.map(&:run) end def stopping clients.map(&:stop) end # @return [Array<Client>] def clients @clients ||= [] end private def mutex @mutex ||= Mutex.new end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
backport-1.0.0 | lib/backport/server/connectable.rb |