Permalink
Browse files

use extract_options! from the Twitter gem

  • Loading branch information...
1 parent 549f678 commit a63942dec7099efc74bc3d6bdae76a287de1d0ef @stve stve committed Aug 16, 2012
Showing with 3 additions and 6 deletions.
  1. +3 −6 lib/tweetstream/client.rb
@@ -78,8 +78,7 @@ def sample(query_parameters = {}, &block)
# Keywords containing punctuation will only exact match tokens.
# Query parameters may be passed as the last argument.
def track(*keywords, &block)
- query_params = keywords.pop if keywords.last.is_a?(::Hash)
- query_params ||= {}
+ query_params = keywords.extract_options!
filter(query_params.merge(:track => keywords), &block)
end
@@ -88,8 +87,7 @@ def track(*keywords, &block)
# pressing the reply "swoosh") are not matched. Requires integer user
# IDs, not screen names. Query parameters may be passed as the last argument.
def follow(*user_ids, &block)
- query_params = user_ids.pop if user_ids.last.is_a?(::Hash)
- query_params ||= {}
+ query_params = user_ids.extract_options!
filter(query_params.merge(:follow => user_ids), &block)
end
@@ -102,8 +100,7 @@ def follow(*user_ids, &block)
# the first pair denoting the southwest corner of the box
# longitude/latitude pairs, separated by commas. The first pair specifies the southwest corner of the box.
def locations(*locations_map, &block)
- query_params = locations_map.pop if locations_map.last.is_a?(::Hash)
- query_params ||= {}
+ query_params = locations_map.extract_options!
filter(query_params.merge(:locations => locations_map), &block)
end

0 comments on commit a63942d

Please sign in to comment.