module LiteCable::Channel::Registry

Stores channels identifiers and corresponding classes.

Public Class Methods

add(id, channel_class) click to toggle source
# File lib/lite_cable/channel/registry.rb, line 14
def add(id, channel_class)
  raise AlreadyRegisteredError if find(id)

  channels[id] = channel_class
end
find(id) click to toggle source
# File lib/lite_cable/channel/registry.rb, line 20
def find(id)
  channels[id]
end
find!(id) click to toggle source
# File lib/lite_cable/channel/registry.rb, line 24
def find!(id)
  channel_class = find(id)
  raise UnknownChannelError unless channel_class

  channel_class
end

Private Class Methods

channels() click to toggle source
# File lib/lite_cable/channel/registry.rb, line 33
def channels
  @channels ||= {}
end