lib/t/utils.rb in t-1.4.0 vs lib/t/utils.rb in t-1.5.0
- old
+ new
@@ -93,7 +93,23 @@
def pluralize(count, singular, plural=nil)
"#{count || 0} " + ((count == 1 || count =~ /^1(\.0+)?$/) ? singular : (plural || "#{singular}s"))
end
+ def decode_full_text(tweet, decode_full_urls = false)
+ text = HTMLEntities.new.decode(tweet.full_text)
+ text = decode_urls(text, tweet.urls) if decode_full_urls
+ text
+ end
+
+ def decode_urls(full_text, url_entities)
+ return full_text if url_entities.nil?
+
+ url_entities.each do |url_hash|
+ full_text = full_text.gsub(url_hash.url, url_hash.expanded_url)
+ end
+
+ full_text
+ end
+
end
end