Module: Loco

Defined in:
lib/loco/emitter.rb,
lib/loco/hub.rb,
lib/loco-rails.rb,
lib/loco/config.rb,
lib/loco/sender.rb,
lib/loco/helpers.rb,
lib/loco/version.rb,
lib/loco/broadcaster.rb,
lib/loco/rails/engine.rb,
app/jobs/loco/sender_job.rb,
app/models/loco/notification.rb,
lib/loco/ws_connection_finder.rb,
lib/loco/permissions_presenter.rb,
lib/loco/ws_connection_checker.rb,
lib/loco/ws_connection_manager.rb,
lib/loco/ws_connection_storage.rb,
lib/loco/ws_connection_identifier.rb,
app/services/loco/notification/fetcher.rb,
app/controllers/loco/application_controller.rb,
app/channels/loco/notification_center_channel.rb,
lib/generators/loco/install/install_generator.rb,
app/controllers/loco/notification_center_controller.rb,
lib/generators/loco/initializer/initializer_generator.rb,
lib/generators/loco/file_injector/file_injector_generator.rb,
lib/generators/loco/notification_center/notification_center_generator.rb,
lib/generators/loco/notification_center/templates/services/loco/notification_center.rb

Overview

TODO: remove in v7

Defined Under Namespace

Modules: Emitter, Helpers, PermissionsPresenter, WsConnectionChecker, WsConnectionIdentifier Classes: ApplicationController, Broadcaster, Config, Engine, FileInjectorGenerator, Hub, InitializerGenerator, InstallGenerator, Notification, NotificationCenter, NotificationCenterChannel, NotificationCenterController, NotificationCenterGenerator, Sender, SenderJob, WsConnectionFinder, WsConnectionManager, WsConnectionStorage

Constant Summary collapse

VERSION =
'6.2.0'

Class Method Summary collapse

Class Method Details

.add_hub(name, members = []) ⇒ Object



42
43
44
# File 'lib/loco-rails.rb', line 42

def add_hub(name, members = [])
  Hub.set(name, members)
end

.configureObject



22
23
24
25
26
27
# 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) ⇒ Object



50
51
52
53
54
55
# 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 = {}) ⇒ Object



29
30
31
32
33
34
35
36
# 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) ⇒ Object



38
39
40
# File 'lib/loco-rails.rb', line 38

def emit_to(recipient_s, data)
  Sender.(recipient_s, data)
end

.get_hub(name) ⇒ Object



46
47
48
# File 'lib/loco-rails.rb', line 46

def get_hub(name)
  Hub.get(name)
end