Class: Atig::IFilter::ExpandUrl
- Inherits:
-
Object
- Object
- Atig::IFilter::ExpandUrl
- Includes:
- Util
- Defined in:
- lib/atig/ifilter/expand_url.rb
Instance Method Summary collapse
- #call(status) ⇒ Object
-
#initialize(context) ⇒ ExpandUrl
constructor
A new instance of ExpandUrl.
Methods included from ExceptionUtil
Constructor Details
Instance Method Details
#call(status) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/atig/ifilter/expand_url.rb', line 18 def call(status) target = short_url_regexp entities = (entities = status.entities).nil? ? [] : entities.urls status.merge :text => status.text.gsub(target) {|url| unless entities.nil? or entities.empty? @cache[url] ||= search_url_from_entities(url, entities) url = @cache[url] if @cache[url] =~ target end @cache[url] ||= resolve_http_redirect(URI(url)).to_s || url } end |