Class: CableX::Channel::CableXChannel

Inherits:
CableX::Cable::Channel show all
Includes:
Process::Controller, Process::Request, Process::Response
Defined in:
lib/cable_x/channel/cable_x_channel.rb

Overview

CableXChannel class to serve subscription, and cmd execution

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Process::Response

#prepare_response, #set_response

Methods included from Process::Request

#set_request

Methods included from Process::Controller

#controller_klass, #invoke_controller, #set_controller, #set_controller_hash

Instance Attribute Details

#controller_action_hashObject (readonly)

Returns the value of attribute controller_action_hash.



16
17
18
# File 'lib/cable_x/channel/cable_x_channel.rb', line 16

def controller_action_hash
  @controller_action_hash
end

#ctrlObject (readonly)

Returns the value of attribute ctrl.



16
17
18
# File 'lib/cable_x/channel/cable_x_channel.rb', line 16

def ctrl
  @ctrl
end

#dataObject (readonly)

Returns the value of attribute data.



16
17
18
# File 'lib/cable_x/channel/cable_x_channel.rb', line 16

def data
  @data
end

#requestObject (readonly)

Returns the value of attribute request.



16
17
18
# File 'lib/cable_x/channel/cable_x_channel.rb', line 16

def request
  @request
end

#request_idObject (readonly)

Returns the value of attribute request_id.



16
17
18
# File 'lib/cable_x/channel/cable_x_channel.rb', line 16

def request_id
  @request_id
end

#responseObject (readonly)

Returns the value of attribute response.



16
17
18
# File 'lib/cable_x/channel/cable_x_channel.rb', line 16

def response
  @response
end

#response_bodyObject (readonly)

Returns the value of attribute response_body.



16
17
18
# File 'lib/cable_x/channel/cable_x_channel.rb', line 16

def response_body
  @response_body
end

Instance Method Details

#cmd(data) ⇒ Object



25
26
27
28
29
30
# File 'lib/cable_x/channel/cable_x_channel.rb', line 25

def cmd(data)
  @data = data
  invoke_controller
  prepare_response
  transmit response_body, via: device_id
end

#subscribedObject



18
19
20
21
# File 'lib/cable_x/channel/cable_x_channel.rb', line 18

def subscribed
  reject unless device_id.present?
  stream_from device_id
end

#unsubscribedObject



23
# File 'lib/cable_x/channel/cable_x_channel.rb', line 23

def unsubscribed; end