Sha256: dd510e6fc5cf51743ffe921dd49012fb18c9dd8c3fbcb5f7eec27abf8f363342

Contents?: true

Size: 718 Bytes

Versions: 31

Compression:

Stored size: 718 Bytes

Contents

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

class Mechanize::RobotsDisallowedError < Mechanize::Error
  def initialize(url)
    if url.is_a?(URI)
      @url = url.to_s
      @uri = url
    else
      @url = url.to_s
    end
  end

  # Returns the URL (string) of the resource that caused this error.
  attr_reader :url

  # 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.
  def uri
    @uri ||= URI.parse(url)
  end

  def to_s
    "Robots access is disallowed for URL: #{url}"
  end
  alias :inspect :to_s
end

Version data entries

31 entries across 31 versions & 5 rubygems

Version Path
mechanize-2.7.7 lib/mechanize/robots_disallowed_error.rb
husc-0.2.1 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/robots_disallowed_error.rb
husc-0.2.0 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/robots_disallowed_error.rb
husc-0.1.1 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/robots_disallowed_error.rb
husc-0.1.0 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/robots_disallowed_error.rb
mechanize-2.7.6 lib/mechanize/robots_disallowed_error.rb
mechanize-2.7.5 lib/mechanize/robots_disallowed_error.rb
mechanize-2.7.4 lib/mechanize/robots_disallowed_error.rb
mechanize-2.7.3 lib/mechanize/robots_disallowed_error.rb
mechanize-2.7.2 lib/mechanize/robots_disallowed_error.rb
mechanize-2.7.1 lib/mechanize/robots_disallowed_error.rb
mechanize-2.7.0 lib/mechanize/robots_disallowed_error.rb
mechanize-2.6.0 lib/mechanize/robots_disallowed_error.rb
mechanize-2.5.1 lib/mechanize/robots_disallowed_error.rb
mechanize-2.5 lib/mechanize/robots_disallowed_error.rb
mechanize-2.4 lib/mechanize/robots_disallowed_error.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/mechanize-2.3/lib/mechanize/robots_disallowed_error.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/mechanize-2.3/lib/mechanize/robots_disallowed_error.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/mechanize-2.3/lib/mechanize/robots_disallowed_error.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/mechanize-2.3/lib/mechanize/robots_disallowed_error.rb