Class: Gitdocs::Notifier
- Inherits:
-
Object
- Object
- Gitdocs::Notifier
- Includes:
- Singleton
- Defined in:
- lib/gitdocs/notifier.rb
Class Method Summary collapse
- .disconnect ⇒ void
- .error(title, message, show_notification = true) ⇒ void
- .info(title, message, show_notification) ⇒ void
- .warn(title, message, show_notification) ⇒ void
Instance Method Summary collapse
Class Method Details
.disconnect ⇒ void
This method returns an undefined value.
63 64 65 |
# File 'lib/gitdocs/notifier.rb', line 63 def self.disconnect instance.disconnect end |
.error(title, message) ⇒ void .error(title, message, show_notification) ⇒ void
This method returns an undefined value.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/gitdocs/notifier.rb', line 50 def self.error(title, , show_notification = true) Gitdocs.log_error("#{title}: #{}") if show_notification instance.notify(title, , :failed) else Kernel.warn("#{title}: #{}") end rescue # rubocop:disable Lint/HandleExceptions # Prevent StandardErrors from stopping the daemon. end |
.info(title, message, show_notification) ⇒ void
This method returns an undefined value.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gitdocs/notifier.rb', line 13 def self.info(title, , show_notification) Gitdocs.log_info("#{title}: #{}") if show_notification instance.notify(title, , :success) else puts("#{title}: #{}") end rescue # rubocop:disable Lint/HandleExceptions # Prevent StandardErrors from stopping the daemon. end |
.warn(title, message, show_notification) ⇒ void
This method returns an undefined value.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/gitdocs/notifier.rb', line 29 def self.warn(title, , show_notification) Gitdocs.log_warn("#{title}: #{}") if show_notification instance.notify(title, , :pending) else Kernel.warn("#{title}: #{}") end rescue # rubocop:disable Lint/HandleExceptions # Prevent StandardErrors from stopping the daemon. end |
Instance Method Details
#disconnect ⇒ void
This method returns an undefined value.
82 83 84 85 |
# File 'lib/gitdocs/notifier.rb', line 82 def disconnect @notifier.disconnect if @notifier @notifier = nil end |
#notify(title, message, type) ⇒ void
This method returns an undefined value.
75 76 77 78 |
# File 'lib/gitdocs/notifier.rb', line 75 def notify(title, , type) @notifier ||= Notiffany.connect @notifier.notify(, title: title, image: type) end |