Mercurial > rsstweet
comparison app/helpers/application_helper.rb @ 98:c5c095f6981e
Expand the urls
| author | nanaya <me@myconan.net> |
|---|---|
| date | Sat, 17 Sep 2016 13:41:05 +0900 |
| parents | 0c8a8b390145 |
| children | 1251b3d6ec5d |
comparison
equal
deleted
inserted
replaced
| 97:ff5557f9902c | 98:c5c095f6981e |
|---|---|
| 10 end | 10 end |
| 11 | 11 |
| 12 def atom_id(id) | 12 def atom_id(id) |
| 13 "tag:#{request.host_with_port},2005:#{id}" | 13 "tag:#{request.host_with_port},2005:#{id}" |
| 14 end | 14 end |
| 15 | |
| 16 def expand_url(text) | |
| 17 text.gsub /https?:\/\/t\.co\/[A-Za-z0-9]+/ do |url| | |
| 18 Rails.cache.fetch url, :expires_in => 1.hour do | |
| 19 " #{Embiggen::URI(url).expand} " | |
| 20 end | |
| 21 end | |
| 22 end | |
| 15 end | 23 end |
