Class: Guard::RSpec::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/rspec/notifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Notifier

Returns a new instance of Notifier.



6
7
8
# File 'lib/guard/rspec/notifier.rb', line 6

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/guard/rspec/notifier.rb', line 4

def options
  @options
end

Instance Method Details

#notify(summary) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/guard/rspec/notifier.rb', line 10

def notify(summary)
  return unless options[:notification]
  failure_count, pending_count = _parse_summary(summary)
  image = _image(failure_count, pending_count)
  priority = _priority(image)
  Guard::Compat::UI.notify(summary,
                           title: @options[:title],
                           image: image,
                           priority: priority)
end

#notify_failureObject



21
22
23
24
25
26
27
# File 'lib/guard/rspec/notifier.rb', line 21

def notify_failure
  return unless options[:notification]
  Guard::Compat::UI.notify("Failed",
                           title: @options[:title],
                           image: :failed,
                           priority: 2)
end