Mercurial > rsstweet
view app/helpers/application_helper.rb @ 108:8b2d770160e3
Increase count to 100
As feedbin fetching delay increased to 10 minutes, someone may now tweet over 40 times and thus hiding the older tweets.
author | nanaya <me@myconan.net> |
---|---|
date | Sun, 30 Oct 2016 04:26:09 +0900 |
parents | 1251b3d6ec5d |
children | 950849c40d42 |
line wrap: on
line source
module ApplicationHelper include Twitter::Autolink def ellipsize(text, limit = 30) if text.length <= limit text else "#{text.first(limit)}..." end end def atom_id(id) "tag:#{request.host_with_port},2005:#{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] @any = 1 end result end text.gsub /https?:\/\/t\.co\/[A-Za-z0-9]+/ do |url| urls[url] || url end end end