Class: Mbeditor::EditorChannel

Inherits:
CableBaseClass
  • Object
show all
Defined in:
app/channels/mbeditor/editor_channel.rb

Instance Method Summary collapse

Instance Method Details

#save_branch_state(data) ⇒ Object



24
25
26
27
28
29
30
# File 'app/channels/mbeditor/editor_channel.rb', line 24

def save_branch_state(data)
  branch = data["branch"].to_s.strip
  state  = data["state"]
  EditorStateService.new(workspace_root).write_branch_state(branch, state)
rescue StandardError
  # Never let a state-save failure crash the WebSocket connection
end

#save_state(data) ⇒ Object



17
18
19
20
21
22
# File 'app/channels/mbeditor/editor_channel.rb', line 17

def save_state(data)
  state = data["state"] || data
  EditorStateService.new(workspace_root).write_state(state)
rescue StandardError
  # Never let a state-save failure crash the WebSocket connection
end

#subscribedObject



9
10
11
# File 'app/channels/mbeditor/editor_channel.rb', line 9

def subscribed
  stream_from "mbeditor_editor" if respond_to?(:stream_from)
end

#unsubscribedObject



13
14
15
# File 'app/channels/mbeditor/editor_channel.rb', line 13

def unsubscribed
  # no-op
end