Parent

WebRobots::RobotsTxt::Record

Attributes

delay[R]
options[R]

Public Class Methods

new(agentlines, rulelines) click to toggle source
     # File lib/webrobots/robotstxt.rb, line 606
606:       def initialize(agentlines, rulelines)
607:         @patterns = agentlines.map { |agentline| agentline.pattern }
608:         @acls = []
609:         @delay = nil
610:         @options = {}
611:         rulelines.each { |ruleline|
612:           case ruleline
613:           when AccessControlLine
614:             @acls << ruleline
615:           when CrawlDelayLine
616:             @delay = ruleline.delay
617:           else
618:             @options[ruleline.token.downcase] = ruleline.value
619:           end
620:         } if rulelines
621:         @acls.replace @acls.sort_by { |x|
622:           [-x.value.length, x.is_a?(AllowLine) ? 1 : 0]
623:         }
624:       end

Public Instance Methods

allow?(request_uri) click to toggle source
     # File lib/webrobots/robotstxt.rb, line 638
638:       def allow?(request_uri)
639:         @acls.each { |acl|
640:           if acl.match?(request_uri)
641:             return acl.allow?
642:           end
643:         }
644:         return true
645:       end
default?() click to toggle source
     # File lib/webrobots/robotstxt.rb, line 634
634:       def default?
635:         @patterns.include?(//)
636:       end
match?(user_agent) click to toggle source
     # File lib/webrobots/robotstxt.rb, line 628
628:       def match?(user_agent)
629:         @patterns.any? { |pattern|
630:           pattern.match(user_agent)
631:         }
632:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.