-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow users to pass in screen names with leading '@'
- Loading branch information
Showing
5 changed files
with
75 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,17 @@ class Client | |
module Utils | ||
private | ||
|
||
def clean_screen_name!(screen_name) | ||
screen_name.gsub!(/[@@]/, '') if screen_name | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sferik
Author
Owner
|
||
end | ||
|
||
def merge_user_into_options!(user_id_or_screen_name, options={}) | ||
case user_id_or_screen_name | ||
when Fixnum | ||
options[:user_id] = user_id_or_screen_name | ||
when String | ||
options[:screen_name] = user_id_or_screen_name.gsub('@', '') | ||
when Fixnum | ||
options[:user_id] = user_id_or_screen_name | ||
when String | ||
clean_screen_name!(user_id_or_screen_name) | ||
options[:screen_name] = user_id_or_screen_name | ||
end | ||
options | ||
end | ||
|
@@ -18,10 +23,11 @@ def merge_users_into_options!(user_ids_or_screen_names, options={}) | |
user_ids, screen_names = [], [] | ||
user_ids_or_screen_names.flatten.each do |user_id_or_screen_name| | ||
case user_id_or_screen_name | ||
when Fixnum | ||
user_ids << user_id_or_screen_name | ||
when String | ||
screen_names << user_id_or_screen_name.gsub('@', '') | ||
when Fixnum | ||
user_ids << user_id_or_screen_name | ||
when String | ||
clean_screen_name!(user_id_or_screen_name) | ||
screen_names << user_id_or_screen_name | ||
end | ||
end | ||
options[:user_id] = user_ids.join(',') unless user_ids.empty? | ||
|
The second "at" symbol in the regular expression in this line blows up on my Mac and Linux machines.
Namely: in `require': /home/gaustin/.rvm/gems/ruby-1.9.2-p0/gems/twitter-1.0.0.rc.6/lib/twitter/client/utils.rb:9: invalid multibyte char (US-ASCII) (SyntaxError)
/home/gaustin/.rvm/gems/ruby-1.9.2-p0/gems/twitter-1.0.0.rc.6/lib/twitter/client/utils.rb:9: invalid multibyte char (US-ASCII)
/home/gaustin/.rvm/gems/ruby-1.9.2-p0/gems/twitter-1.0.0.rc.6/lib/twitter/client/utils.rb:9: syntax error, unexpected $end, expecting ')'