Class: Twterm::NotificationDispatcher

Inherits:
Object
  • Object
show all
Includes:
Subscriber
Defined in:
lib/twterm/notification_dispatcher.rb

Instance Method Summary collapse

Methods included from Subscriber

included, #subscribe, #unsubscribe

Constructor Details

#initialize(preferences) ⇒ NotificationDispatcher

Returns a new instance of NotificationDispatcher.

Parameters:



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/twterm/notification_dispatcher.rb', line 12

def initialize(preferences)
  @preferences = preferences

  @backends = {
    inline: NotificationBackend::InlineBackend.new,
    terminal_notifier: NotificationBackend::TerminalNotifierBackend.new,
    tmux: NotificationBackend::TmuxBackend.new,
  }

  subscribe(Event::Notification::AbstractNotification) { |n| dispatch(n) }
end