class TweetStream::Daemon
A daemonized TweetStream client that will
allow you to create backgroundable scripts for application specific
processes. For instance, if you create a script called
tracker.rb
and fill it with this:
require 'rubygems' require 'tweetstream' TweetStream.configure do |config| config.consumer_key = 'abcdefghijklmnopqrstuvwxyz' config.consumer_secret = '0123456789' config.oauth_token = 'abcdefghijklmnopqrstuvwxyz' config.oauth_token_secret = '0123456789' config.auth_method = :oauth end TweetStream::Daemon.new('tracker').track('intridea') do |status| # do something here end
And then you call this from the shell:
ruby tracker.rb start
A daemon process will spawn that will automatically run the code in the passed block whenever a new tweet matching your search term ('intridea' in this case) is posted.
Constants
- DEFAULT_NAME
- DEFAULT_OPTIONS
Attributes
app_name[RW]
daemon_options[RW]
Public Class Methods
new(name = DEFAULT_NAME, options = DEFAULT_OPTIONS)
click to toggle source
The daemon has an optional process name for use when querying running processes. You can also pass daemon options.
Calls superclass method
TweetStream::Client.new
# File lib/tweetstream/daemon.rb, line 40 def initialize(name = DEFAULT_NAME, options = DEFAULT_OPTIONS) @app_name = name @daemon_options = options super({}) end