Class: Upkeep::Rails::Cable::SubscribeContext

Inherits:
Object
  • Object
show all
Defined in:
lib/upkeep/rails/cable/subscriber_identity.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ SubscribeContext

Returns a new instance of SubscribeContext.



16
17
18
# File 'lib/upkeep/rails/cable/subscriber_identity.rb', line 16

def initialize(connection)
  @action_cable_connection = connection
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/upkeep/rails/cable/subscriber_identity.rb', line 28

def method_missing(name, *args, &block)
  if action_cable_connection.respond_to?(name)
    action_cable_connection.public_send(name, *args, &block)
  else
    super
  end
end

Instance Method Details

#cookiesObject



24
25
26
# File 'lib/upkeep/rails/cable/subscriber_identity.rb', line 24

def cookies
  action_cable_request.cookies
end

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/upkeep/rails/cable/subscriber_identity.rb', line 36

def respond_to_missing?(name, include_private = false)
  action_cable_connection.respond_to?(name, false) || super
end

#sessionObject



20
21
22
# File 'lib/upkeep/rails/cable/subscriber_identity.rb', line 20

def session
  action_cable_request.session
end