class Gitdocs::Notifier
Public Class Methods
disconnect()
click to toggle source
@return [void]
# File lib/gitdocs/notifier.rb, line 62 def self.disconnect instance.disconnect end
error(title, message, show_notification = true)
click to toggle source
@overload error(title, message)
@param [String] title @param [String] message
@overload error(title, message, show_notification)
@param [String] title @param [String] message @param [Boolean] show_notification
@return [void]
# File lib/gitdocs/notifier.rb, line 49 def self.error(title, message, show_notification = true) Gitdocs.log_error("#{title}: #{message}") if show_notification instance.notify(title, message, :failed) else Kernel.warn("#{title}: #{message}") end rescue # rubocop:disable Lint/HandleExceptions # Prevent StandardErrors from stopping the daemon. end
info(title, message, show_notification)
click to toggle source
@param [String] title @param [String] message @param [Boolean] show_notification
@return [void]
# File lib/gitdocs/notifier.rb, line 12 def self.info(title, message, show_notification) Gitdocs.log_info("#{title}: #{message}") if show_notification instance.notify(title, message, :success) else puts("#{title}: #{message}") end rescue # rubocop:disable Lint/HandleExceptions # Prevent StandardErrors from stopping the daemon. end
warn(title, message, show_notification)
click to toggle source
@param [String] title @param [String] message @param [Boolean] show_notification
@return [void]
# File lib/gitdocs/notifier.rb, line 28 def self.warn(title, message, show_notification) Gitdocs.log_warn("#{title}: #{message}") if show_notification instance.notify(title, message, :pending) else Kernel.warn("#{title}: #{message}") end rescue # rubocop:disable Lint/HandleExceptions # Prevent StandardErrors from stopping the daemon. end
Public Instance Methods
disconnect()
click to toggle source
@private @return [void]
# File lib/gitdocs/notifier.rb, line 81 def disconnect @notifier.disconnect if @notifier @notifier = nil end
notify(title, message, type)
click to toggle source
@private @param [String] title @param [String] message @param [:success, :pending, :failed] type
@return [void]
# File lib/gitdocs/notifier.rb, line 74 def notify(title, message, type) @notifier ||= Notiffany.connect @notifier.notify(message, title: title, image: type) end