class Mechanize::RobotsDisallowedError

Exception that is raised when an access to a resource is disallowed by robots.txt or by HTML document itself.

Attributes

url[R]

Returns the URL (string) of the resource that caused this error.

Public Class Methods

new(url) click to toggle source
# File lib/mechanize/robots_disallowed_error.rb, line 5
def initialize(url)
  if url.is_a?(URI)
    @url = url.to_s
    @uri = url
  else
    @url = url.to_s
  end
end

Public Instance Methods

inspect()
Alias for: to_s
to_s() click to toggle source
# File lib/mechanize/robots_disallowed_error.rb, line 24
def to_s
  "Robots access is disallowed for URL: #{url}"
end
Also aliased as: inspect
uri() click to toggle source

Returns the URL (URI object) of the resource that caused this error. URI::InvalidURIError may be raised if the URL happens to be invalid or not understood by the URI library.

# File lib/mechanize/robots_disallowed_error.rb, line 20
def uri
  @uri ||= URI.parse(url)
end