Skip to content

Instantly share code, notes, and snippets.

@adgilfillan
Last active August 29, 2015 14:08
Show Gist options
  • Save adgilfillan/f6eaf0988bcb7e4c0560 to your computer and use it in GitHub Desktop.
Save adgilfillan/f6eaf0988bcb7e4c0560 to your computer and use it in GitHub Desktop.
Rails Twitter Gem - Sorting Tweets with Include? Function
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