Skip to content

Looking instead of watching

lukes edited this page May 4, 2011 · 2 revisions

Rather than watching, if you just want to get a single poll of keywords, use once(). All the same parameters as with watch() can be used (every will be ignored)

herald = Herald.once do
  check :twitter
  _for "#herald"
end

As with watching, Herald will fork a new process (or one for every source you're checking), but unlike with watching, Herald will block and wait for the process to finish

herald.start # waiting ... process ends at the same time you receive your notifications
herald.alive? # => false

See also

Clone this wiki locally