Skip to content

Commit

Permalink
Added a filter option to search, lets you specifiy options to filter …
Browse files Browse the repository at this point in the history
…by, such as 'links' (@pjdavis)
  • Loading branch information
sferik committed Sep 24, 2010
1 parent 2e05847 commit 0b37998
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/twitter/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def containing(word, exclude=false)
end
alias :contains :containing

def filter(filter)
@query[:q] << "filter:#{filter}"
self
end

def retweeted
@query[:q] << "rt"
self
Expand Down
4 changes: 4 additions & 0 deletions test/twitter/search_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class SearchTest < Test::Unit::TestCase
@search.not_retweeted.query[:q].should include('-rt')
end

should "should be able to specify filters" do
@search.filter('links').query[:q].should include('filter:links')
end

should "should be able to specify hashed" do
@search.hashed('twitter').query[:q].should include('#twitter')
end
Expand Down

0 comments on commit 0b37998

Please sign in to comment.