Sha256: 644eac2450f72fb1d23419d3d3c95c48edb6608524efc79b7fe242a963f506a0

Contents?: true

Size: 1 KB

Versions: 21

Compression:

Stored size: 1 KB

Contents

# Toplevel Pubnub module.
module Pubnub
  # Pubnub client Class
  class Client
    # Module that holds some helper methods
    module Helpers
      private

      def totally_empty(hash)
        hash.reduce(true) { |acc, (_, v)| acc && v.is_a?(Hash) ? totally_empty(v) : false }
      end

      def setup_pools
        # Event pool
        @env[:events] = []

        # Connection pools
        @env[:single_event_conn_pool] = {}
        @env[:subscribe_event_conn_pool] = {}
        @env[:heartbeat_event_conn_pool] = {}

        # Callback pools.
        @env[:c_cb_pool] = {}
        @env[:e_cb_pool] = {}

        # Subscription and heartbeat pools.
        @env[:subscription_pool] = {}
        @env[:heartbeat_pool] = {}

        # Requests pool.
        @env[:req_dispatchers_pool] = {}
        @env[:req_dispatchers_pool][:sync] = {}
        @env[:req_dispatchers_pool][:async] = {}
      end

      def clean_env
        @env.delete_if { |_, v| v.blank? && v != false } # nillify if blank
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pubnub-5.5.0 lib/pubnub/client/helpers.rb
pubnub-5.4.0 lib/pubnub/client/helpers.rb
pubnub-5.3.5 lib/pubnub/client/helpers.rb
pubnub-5.3.4 lib/pubnub/client/helpers.rb
pubnub-5.3.3 lib/pubnub/client/helpers.rb
pubnub-5.3.2 lib/pubnub/client/helpers.rb
pubnub-5.3.1 lib/pubnub/client/helpers.rb
pubnub-5.3.0 lib/pubnub/client/helpers.rb
pubnub-5.2.2 lib/pubnub/client/helpers.rb
pubnub-5.2.1 lib/pubnub/client/helpers.rb
pubnub-5.2.0 lib/pubnub/client/helpers.rb
pubnub-5.1.2 lib/pubnub/client/helpers.rb
pubnub-5.1.1 lib/pubnub/client/helpers.rb
pubnub-5.1.0 lib/pubnub/client/helpers.rb
pubnub-5.0.0 lib/pubnub/client/helpers.rb
pubnub-4.8.0 lib/pubnub/client/helpers.rb
pubnub-4.7.1 lib/pubnub/client/helpers.rb
pubnub-4.7.0 lib/pubnub/client/helpers.rb
pubnub-4.6.2 lib/pubnub/client/helpers.rb
pubnub-4.6.1 lib/pubnub/client/helpers.rb