Permalink
Browse files

Added a filter option to search, lets you specifiy options to filter …

…by, such as 'links' (@pjdavis)
  • Loading branch information...
1 parent 2e05847 commit 0b37998055158d4fed0e3c296d8d2a42ac77d5d9 @sferik committed Sep 24, 2010
Showing with 9 additions and 0 deletions.
  1. +5 −0 lib/twitter/search.rb
  2. +4 −0 test/twitter/search_test.rb
View
@@ -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
@@ -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

0 comments on commit 0b37998

Please sign in to comment.