module Loco

TODO: remove in v7

Constants

VERSION

Public Instance Methods

add_hub(name, members = []) click to toggle source
# File lib/loco-rails.rb, line 42
def add_hub(name, members = [])
  Hub.set(name, members)
end
configure() { |config| ... } click to toggle source
# File lib/loco-rails.rb, line 22
def configure
  Config::CONFIGURATION.new.tap do |config|
    yield config
    Config.configure config
  end
end
del_hub(name) click to toggle source
# File lib/loco-rails.rb, line 50
def del_hub(name)
  hub = Hub.get(name)
  return false if hub.nil?

  hub.destroy
end
emit(obj, event = nil, opts = {}) click to toggle source
# File lib/loco-rails.rb, line 29
def emit(obj, event = nil, opts = {})
  Broadcaster.(
    obj,
    event,
    payload: opts[:payload] || opts[:data],
    recipients: opts[opts[:for] ? :for : :to]
  )
end
emit_to(recipient_s, data) click to toggle source
# File lib/loco-rails.rb, line 38
def emit_to(recipient_s, data)
  Sender.(recipient_s, data)
end
get_hub(name) click to toggle source
# File lib/loco-rails.rb, line 46
def get_hub(name)
  Hub.get(name)
end