Class: BirdGrinder::StreamHandler

Inherits:
Base
  • Object
show all
Defined in:
lib/bird_grinder/stream_handler.rb

Overview

A simple BirdGrinder::Base subclass which has a focus on processing tweets from a stream.

Instance Attribute Summary

Attributes inherited from Base

#client, #options, #user

Class Method Summary collapse

Methods inherited from Base

#dm, event_handlers_for, #handle, on_event, register!, #reply, #tweet

Class Method Details

.delete_from_stream(name, &blk) ⇒ Object

Do something on delete’s from a given stream

Parameters:

  • the (Symbol)

    stream name, e.g. :filter / :sample



18
19
20
21
22
# File 'lib/bird_grinder/stream_handler.rb', line 18

def delete_from_stream(name, &blk)
  on_event(:incoming_stream) do
    instance_eval(&blk) if correct_stream?(name, :delete)
  end
end

.rate_limit_from_stream(name, &blk) ⇒ Object

Do something on rate limit’s from a given stream

Parameters:

  • the (Symbol)

    stream name, e.g. :filter / :sample



26
27
28
29
30
# File 'lib/bird_grinder/stream_handler.rb', line 26

def rate_limit_from_stream(name, &blk)
  on_event(:incoming_stream) do
    instance_eval(&blk) if correct_stream?(name, :limit)
  end
end

.tweet_from_stream(name, &blk) ⇒ Object

Do something on tweet’s from a given stream

Parameters:

  • the (Symbol)

    stream name, e.g. :filter / :sample



10
11
12
13
14
# File 'lib/bird_grinder/stream_handler.rb', line 10

def tweet_from_stream(name, &blk)
  on_event(:incoming_stream) do
    instance_eval(&blk) if correct_stream?(name, :tweet)
  end
end