Module: Travis::Notifications
- Extended by:
- Logging
- Defined in:
- lib/travis/notifications.rb,
lib/travis/notifications/irc.rb,
lib/travis/notifications/email.rb,
lib/travis/notifications/pusher.rb,
lib/travis/notifications/worker.rb,
lib/travis/notifications/webhook.rb,
lib/travis/notifications/worker/queue.rb,
lib/travis/notifications/pusher/payload.rb,
lib/travis/notifications/worker/payload.rb,
lib/travis/notifications/webhook/payload.rb
Defined Under Namespace
Classes: Email, Irc, Pusher, Webhook, Worker
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Logging
included, log, logger, notice
Class Method Details
.dispatch(event, *args) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/travis/notifications.rb', line 19
def dispatch(event, *args)
subscriptions.each do |subscriber, subscription|
if matches?(subscription, event)
log "notifying #{subscriber.class.name} about #{event.inspect} (#{args.map { |arg| arg.inspect }.join(', ')})"
subscriber.notify(event, *args)
end
end
end
|
.subscriptions ⇒ Object
12
13
14
15
16
17
|
# File 'lib/travis/notifications.rb', line 12
def subscriptions
@subscriptions ||= Array(Travis.config.notifications).inject({}) do |subscriptions, subscriber|
subscriber = const_get(subscriber.to_s.camelize)
subscriptions.merge(subscriber.new => subscriber::EVENTS)
end
end
|
Instance Method Details
#notify(event, *args) ⇒ Object
37
38
39
|
# File 'lib/travis/notifications.rb', line 37
def notify(event, *args)
Travis::Notifications.dispatch(client_event(event, self), self, *args)
end
|