Module: Scrapbooker::Helpers::TweetHelpers
- Included in:
- Scrapbooker::Helpers
- Defined in:
- lib/scrapbooker/helpers/tweet_helpers.rb
Instance Method Summary collapse
- #expand_hashtag(hashtag, tweet) ⇒ Object
- #expand_link(link, tweet) ⇒ Object
- #expand_media(media, tweet) ⇒ Object
- #expand_mention(mention, tweet) ⇒ Object
- #render_tweet(tweet) ⇒ Object
Instance Method Details
#expand_hashtag(hashtag, tweet) ⇒ Object
14 15 16 |
# File 'lib/scrapbooker/helpers/tweet_helpers.rb', line 14 def (hashtag,tweet) tweet.sub!("#{hashtag}", link_to(hashtag,"http://twitter.com/search/#{URI.escape(hashtag)}",:target => :blank)) end |
#expand_link(link, tweet) ⇒ Object
18 19 20 |
# File 'lib/scrapbooker/helpers/tweet_helpers.rb', line 18 def (link,tweet) tweet.sub!(link['display'], link_to(link['source'],link['source'],:target => :blank)) end |
#expand_media(media, tweet) ⇒ Object
22 23 24 |
# File 'lib/scrapbooker/helpers/tweet_helpers.rb', line 22 def (media,tweet) tweet.sub!(media['display'], link_to(media['source'],media['source'],:target => :blank)) end |
#expand_mention(mention, tweet) ⇒ Object
26 27 28 |
# File 'lib/scrapbooker/helpers/tweet_helpers.rb', line 26 def (mention,tweet) tweet.sub!(/@#{mention}/i, link_to("@#{mention}","http://twitter.com/#{mention}",:target => :blank)) end |
#render_tweet(tweet) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/scrapbooker/helpers/tweet_helpers.rb', line 5 def render_tweet(tweet) rendered_tweet = tweet.entry tweet..each { |hashtag| (hashtag,rendered_tweet) } tweet.mentions.each { |mention| (mention,rendered_tweet) } tweet.links.each { |link| (link,rendered_tweet) } tweet.media.each { |media| (media,rendered_tweet) } return raw rendered_tweet end |