Class: Guard::Pushover

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/pushover.rb

Overview

Send notifications to Pushover

Constant Summary collapse

DEFAULTS =
{
  :title => 'Guard',
  :priority => 0
}

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ Pushover

Returns a new instance of Pushover.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/guard/pushover.rb', line 15

def initialize(watchers = [], options = {})
  options = DEFAULTS.merge(options)
  @user_key = options.delete(:user_key)
  @api_key = options.delete(:api_key)
  @default_message = options.delete(:message)
  @ignore_changes = options.delete(:ignore_changes)
  @ignore_removals = options.delete(:ignore_removals)
  @ignore_additions = options.delete(:ignore_additions)

  super watchers, options
end

Instance Method Details

#run_on_additions(paths) ⇒ Object



35
36
37
# File 'lib/guard/pushover.rb', line 35

def run_on_additions(paths)
  send_notification "%s was added.", paths.first unless @ignore_additions
end

#run_on_changes(paths) ⇒ Object



27
28
29
# File 'lib/guard/pushover.rb', line 27

def run_on_changes(paths)
  send_notification "%s was changed.", paths.first unless @ignore_changes
end

#run_on_removals(paths) ⇒ Object



31
32
33
# File 'lib/guard/pushover.rb', line 31

def run_on_removals(paths)
  send_notification "%s was removed.", paths.first unless @ignore_removals
end