class WatchKeyTask

Public Instance Methods

notify(old_value, new_value) click to toggle source
# File lib/engine/app/models/watch_key_task.rb, line 18
def notify(old_value, new_value)
  msg = "Value of key '#{trigger}' has changed from #{old_value.inspect} to #{new_value.inspect}"
  Notification.create(reporter: name, message: msg)
end
perform() click to toggle source
# File lib/engine/app/models/watch_key_task.rb, line 6
def perform
  result = RetrieveKey.new(backend, trigger).result
  if data[:initialized]
    notify(data[:old_value], result) if data[:old_value] != result
  else
    data[:initialized] = true
  end

  data[:old_value] = result
  save
end
type_name() click to toggle source
# File lib/engine/app/models/watch_key_task.rb, line 2
def type_name
  'Watch key'
end