Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…by, such as 'links' (@pjdavis)
  • Loading branch information...
commit 0b37998055158d4fed0e3c296d8d2a42ac77d5d9 1 parent 2e05847
@sferik authored
Showing with 9 additions and 0 deletions.
  1. +5 −0 lib/twitter/search.rb
  2. +4 −0 test/twitter/search_test.rb
View
5 lib/twitter/search.rb
@@ -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
View
4 test/twitter/search_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.