class JiraCache::Notifier
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`.
Public Class Methods
new(logger)
click to toggle source
Initializes a notifier with the specified logger. The logger is used to log info messages when publish
is called.
# File lib/jira_cache/notifier.rb, line 17 def initialize(logger) @logger = logger end
Public Instance Methods
publish(event_name, data = nil)
click to toggle source
Simply logs the event name and data. @param event_name [String] e.g. “fetched_issue” @param data [Hash]
- :key [String] issue key - :data [Hash] issue data
# File lib/jira_cache/notifier.rb, line 26 def publish(event_name, data = nil) @logger.info "[#{event_name}] #{data[:key]}" end