Class: Mechanize::Page::MetaRefresh

### Home Classes Methods

### In Files

- lib/mechanize/page/meta_refresh.rb

### Parent

Mechanize::Page::Link

### Methods

- ::from_node
- ::new
- ::parse
- #noreferrer?

### Files

- EXAMPLES.rdoc
- GUIDE.rdoc
- LICENSE.rdoc
- Manifest.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Mechanize
- Mechanize::ChunkedTerminationError
- Mechanize::ContentTypeError
- Mechanize::Cookie
- Mechanize::CookieCMethods
- Mechanize::CookieDeprecated
- Mechanize::CookieIMethods
- Mechanize::CookieJar
- Mechanize::CookieJarIMethods
- Mechanize::DirectorySaver
- Mechanize::Download
- Mechanize::ElementMatcher
- Mechanize::ElementNotFoundError
- Mechanize::Error
- Mechanize::File
- Mechanize::FileConnection
- Mechanize::FileRequest
- Mechanize::FileResponse
- Mechanize::FileSaver
- Mechanize::Form
- Mechanize::Form::Button
- Mechanize::Form::CheckBox
- Mechanize::Form::Field
- Mechanize::Form::FileUpload
- Mechanize::Form::Hidden
- Mechanize::Form::ImageButton
- Mechanize::Form::Keygen
- Mechanize::Form::MultiSelectList
- Mechanize::Form::Option
- Mechanize::Form::RadioButton
- Mechanize::Form::Reset
- Mechanize::Form::SelectList
- Mechanize::Form::Submit
- Mechanize::Form::Text
- Mechanize::Form::Textarea
- Mechanize::HTTP
- Mechanize::HTTP::Agent
- Mechanize::HTTP::AuthChallenge
- Mechanize::HTTP::AuthRealm
- Mechanize::HTTP::AuthStore
- Mechanize::HTTP::ContentDispositionParser
- Mechanize::HTTP::WWWAuthenticateParser
- Mechanize::Headers
- Mechanize::History
- Mechanize::Image
- Mechanize::Page
- Mechanize::Page::Base
- Mechanize::Page::Frame
- Mechanize::Page::Image
- Mechanize::Page::Label
- Mechanize::Page::Link
- Mechanize::Page::MetaRefresh
- Mechanize::Parser
- Mechanize::PluggableParser
- Mechanize::Prependable
- Mechanize::RedirectLimitReachedError
- Mechanize::RedirectNotGetOrHeadError
- Mechanize::ResponseCodeError
- Mechanize::ResponseReadError
- Mechanize::RobotsDisallowedError
- Mechanize::TestCase
- Mechanize::UnauthorizedError
- Mechanize::UnsupportedSchemeError
- Mechanize::Util
- Mechanize::XmlFile
- HTTP
- HTTP::CookieJar

No matching classes.

# Mechanize::Page::MetaRefresh

This class encapsulates a meta element with a refresh http-equiv. Mechanize treats meta refresh elements just like 'a' tags. MetaRefresh objects will contain links, but most likely will have no text.

### Constants

CONTENT_REGEXP

  Matches the content attribute of a meta refresh element. After the match:

      $1:: delay
      $3:: url

UNSAFE

  Regexp of unsafe URI characters that excludes % for Issue #177

### Attributes

delay[R]

Time to wait before next refresh

link_self[R]

This MetaRefresh links did not contain a url= in the content attribute and links to itself.

### Public Class Methods

from_node(node, page, uri = nil) click to toggle source

    # File lib/mechanize/page/meta_refresh.rb, line 55
    def self.from_node node, page, uri = nil
      http_equiv = node['http-equiv'] and
        /\ARefresh\z/ =~ http_equiv or return

      delay, uri, link_self = parse node['content'], uri

      return unless delay

      new node, page, delay, uri, link_self
    end

new(node, page, delay, href, link_self = false) click to toggle source

    # File lib/mechanize/page/meta_refresh.rb, line 66
    def initialize node, page, delay, href, link_self = false
      super node, page.mech, page

      @delay     = delay.include?(..) ? delay.to_f : delay.to_i
      @href      = href
      @link_self = link_self
    end

parse(content, base_uri = nil) click to toggle source

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.

    # File lib/mechanize/page/meta_refresh.rb, line 42
    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

### Public Instance Methods

noreferrer?() click to toggle source

    # File lib/mechanize/page/meta_refresh.rb, line 74
    def noreferrer?
      true
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.