Mercurial > rsstweet
view app/helpers/application_helper.rb @ 175:52252ae4b580
Static tag because it's supposed to be the same across rsstweet installs
author | nanaya <me@nanaya.pro> |
---|---|
date | Tue, 02 Oct 2018 23:58:36 +0900 |
parents | df4be896ab8b |
children | 70e90ea4b870 |
line wrap: on
line source
module ApplicationHelper include Twitter::TwitterText::Autolink def atom_id(id) "tag:rsstweet@nanaya.pro,2014:#{id}" end def expand_url(text, *urls) urls.flatten! urls = urls.reduce({}) do |result, u| if u.try(:[], :url) result[u[:url]] = u[:expanded_url] end result end text.gsub /https?:\/\/t\.co\/[A-Za-z0-9]+/ do |url| urls[url] || url end end end