Sha256: de5a59df85eed5e11450de960bf3317454a11953676c8f7820b77dcbd1acb39e

Contents?: true

Size: 521 Bytes

Versions: 2

Compression:

Stored size: 521 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 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

2 entries across 2 versions & 1 rubygems

Version Path
backport-1.1.2 lib/backport/server/connectable.rb
backport-1.1.1 lib/backport/server/connectable.rb