Sha256: ef4e8e37afa9e15c766a660d4750d34442f1d1bf5d55ecc987b9ab08be60054a

Contents?: true

Size: 761 Bytes

Versions: 1

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

module Tamashii
  module Manager
    # :nodoc:
    module ClientManager
      # rubocop:disable Metrics/MethodLength
      def self.included(other)
        other.class_eval do
          class << self
            def accepted_clients
              @accepted_clients ||= {}
            end

            def [](name)
              accepted_clients[name.to_s]
            end

            def []=(name, client)
              return unless client.is_a?(Client)
              accepted_clients[name.to_s] = client
            end

            def sent_to(id, packet)
              Manager.server.pubsub.send_to(id, packet)
            end
          end
        end
      end
      # rubocop:enable Metrics/MethodLength
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tamashii-manager-0.2.0 lib/tamashii/manager/client_manager.rb