Sha256: ba96b5d9bd170f7587aee35193751ee0573eee739388ed13f2fe372b4903659d
Contents?: true
Size: 705 Bytes
Versions: 3
Compression:
Stored size: 705 Bytes
Contents
begin require 'robots' rescue LoadError end module Spidr class Agent # # Initializes the robots filter. # def initialize_robots unless Object.const_defined?(:Robots) raise(ArgumentError,":robots option given but unable to require 'robots' gem") end @robots = Robots.new(@user_agent) end # # Determines whether a URL is allowed by the robot policy. # # @param [URI::HTTP, String] url # The URL to check. # # @return [Boolean] # Specifies whether a URL is allowed by the robot policy. # def robot_allowed?(url) if @robots @robots.allowed?(url) else true end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spidr-0.7.0 | lib/spidr/agent/robots.rb |
spidr-0.6.1 | lib/spidr/agent/robots.rb |
spidr-0.6.0 | lib/spidr/agent/robots.rb |