Class: Kudzu::Agent::Robots::RuleSet
- Inherits:
-
Model::Base
- Object
- Model::Base
- Kudzu::Agent::Robots::RuleSet
- Defined in:
- lib/kudzu/agent/robots/txt.rb
Instance Attribute Summary collapse
-
#crawl_delay ⇒ Object
Returns the value of attribute crawl_delay.
-
#rules ⇒ Object
Returns the value of attribute rules.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Instance Method Summary collapse
- #allowed_path?(uri) ⇒ Boolean
-
#initialize(attr = {}) ⇒ RuleSet
constructor
A new instance of RuleSet.
Constructor Details
#initialize(attr = {}) ⇒ RuleSet
Returns a new instance of RuleSet.
18 19 20 21 |
# File 'lib/kudzu/agent/robots/txt.rb', line 18 def initialize(attr = {}) self.rules = [] super end |
Instance Attribute Details
#crawl_delay ⇒ Object
Returns the value of attribute crawl_delay.
16 17 18 |
# File 'lib/kudzu/agent/robots/txt.rb', line 16 def crawl_delay @crawl_delay end |
#rules ⇒ Object
Returns the value of attribute rules.
16 17 18 |
# File 'lib/kudzu/agent/robots/txt.rb', line 16 def rules @rules end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
16 17 18 |
# File 'lib/kudzu/agent/robots/txt.rb', line 16 def user_agent @user_agent end |
Instance Method Details
#allowed_path?(uri) ⇒ Boolean
23 24 25 26 27 28 |
# File 'lib/kudzu/agent/robots/txt.rb', line 23 def allowed_path?(uri) rules.each do |rule| return rule.allow if uri.path =~ rule.path end return true end |