Method: Mechanize::Page::MetaRefresh.parse
- Defined in:
- lib/mechanize/page/meta_refresh.rb
permalink .parse(content, base_uri = nil) ⇒ Object
Parses the delay and url from the content attribute of a meta refresh element.
Returns an array of [delay, url, link_self], where the first two are strings containing the respective parts of the refresh value, and link_self is a boolean value that indicates whether the url part is missing or empty. If base_uri, the URI of the current page is given, the value of url becomes an absolute URI.
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mechanize/page/meta_refresh.rb', line 43 def self.parse content, base_uri = nil m = CONTENT_REGEXP.match(content) or return delay, url = m[1], m[3] url &&= url.empty? ? nil : Mechanize::Util.uri_escape(url, UNSAFE) link_self = url.nil? if base_uri url = url ? base_uri + url : base_uri end return delay, url, link_self end |