class WatchQueryTask

Public Instance Methods

notify(old_value, new_value) click to toggle source
# File lib/engine/app/models/watch_query_task.rb, line 20
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_query_task.rb, line 8
def perform
  result = SearchKeys.new(backend, trigger).result.map(&:with_indifferent_access)
  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_query_task.rb, line 4
def type_name
  'Watch query'
end