Class: JiraCache::Notifier
- Inherits:
-
Object
- Object
- JiraCache::Notifier
- Defined in:
- lib/jira_cache/notifier.rb
Overview
This notifiers simply logs messages using the specified logger.
If you want to use this mechanism to trigger actions when events are triggered in JiraCache, you can use the ‘JiraCache::Client.set_notifier(notifier)` method and pass it an instance of a notifier class implementing the `#publish` method with the same signature as `JiraCache::Notifier#publish`.
Instance Method Summary collapse
-
#initialize(logger) ⇒ Notifier
constructor
Initializes a notifier with the specified logger.
-
#publish(event_name, data = nil) ⇒ Object
Simply logs the event name and data.
Constructor Details
#initialize(logger) ⇒ Notifier
Initializes a notifier with the specified logger. The logger is used to log info messages when #publish is called.
17 18 19 |
# File 'lib/jira_cache/notifier.rb', line 17 def initialize(logger) @logger = logger end |
Instance Method Details
#publish(event_name, data = nil) ⇒ Object
Simply logs the event name and data.
26 27 28 |
# File 'lib/jira_cache/notifier.rb', line 26 def publish(event_name, data = nil) @logger.info "[#{event_name}] #{data[:key]}" end |