123456789_123456789_123456789_123456789_123456789_

Module: ActionCable::Connection::Identification

Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: actioncable/lib/action_cable/connection/identification.rb

Class Method Summary

::ActiveSupport::Concern - Extended

class_methods

Define class methods from given block.

included

Evaluate given block in context of base class, so that you can write class macros here.

prepended

Evaluate given block in context of base class, so that you can write class macros here.

append_features, prepend_features

Instance Method Summary

DSL Calls

included

[ GitHub ]


10
11
12
# File 'actioncable/lib/action_cable/connection/identification.rb', line 10

included do
  class_attribute :identifiers, default: Set.new
end

Instance Method Details

#connection_gid(ids) (private)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/connection/identification.rb', line 38

def connection_gid(ids)
  ids.map do |o|
    if o.respond_to? :to_gid_param
      o.to_gid_param
    else
      o.to_s
    end
  end.sort.join(":")
end

#connection_identifier

Return a single connection identifier that combines the value of all the registered identifiers into a single gid.

[ GitHub ]

  
# File 'actioncable/lib/action_cable/connection/identification.rb', line 29

def connection_identifier
  unless defined? @connection_identifier
    @connection_identifier = connection_gid identifiers.filter_map { |id| instance_variable_get("@#{id}") }
  end

  @connection_identifier
end