Last active
August 29, 2015 14:08
-
-
Save adgilfillan/f6eaf0988bcb7e4c0560 to your computer and use it in GitHub Desktop.
Rails Twitter Gem - Sorting Tweets with Include? Function
This file contains hidden or 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
def index | |
sort_ruby_tweets($client.get_tweets("adgilfillan")) | |
end | |
def $client.get_tweets(user) | |
options = {:count => 200, :include_rts => true, :exclude_replies => true} | |
user_timeline(user, options) | |
end | |
def sort_ruby_tweets(tweets) | |
@collected_tweets = [] | |
tweets.each do |num| | |
if num.text.include?("#Ruby") | |
@collected_tweets.push(num) | |
elsif num.text.include?("#Rails") | |
@collected_tweets.push(num) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment