Class: Guard::Karma::Notifier
- Inherits:
-
Object
- Object
- Guard::Karma::Notifier
- Defined in:
- lib/guard/karma/notifier.rb
Constant Summary collapse
- RUNNING_TITLE =
'Karma running...'.freeze
- FAILURE_TITLE =
'Karma failure.'.freeze
- SUCCESS_TITLE =
'Karma success.'.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Notifier
constructor
A new instance of Notifier.
- #notify(summary) ⇒ Object
- #notify_start ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Notifier
Returns a new instance of Notifier.
10 11 12 |
# File 'lib/guard/karma/notifier.rb', line 10 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/guard/karma/notifier.rb', line 8 def @options end |
Instance Method Details
#notify(summary) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/guard/karma/notifier.rb', line 20 def notify(summary) return unless [:notification] run_count, total_count, failure_count = parse_summary(summary) body = "Executed #{run_count} of #{total_count}" if failure_count > 0 body += " with #{failure_count} failure(s)" end title = title(failure_count) image = image(failure_count) priority = priority(image) Guard::Compat::UI.notify(body, title: title, image: image, priority: priority) end |
#notify_start ⇒ Object
14 15 16 17 18 |
# File 'lib/guard/karma/notifier.rb', line 14 def notify_start return unless [:notification] Guard::Compat::UI.notify('', title: RUNNING_TITLE, image: :pending, priority: -1) end |