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.
16 17 18 19 |
# File 'lib/kudzu/agent/robots/txt.rb', line 16 def initialize(attr = {}) self.rules = [] super end |
Instance Attribute Details
#crawl_delay ⇒ Object
Returns the value of attribute crawl_delay.
14 15 16 |
# File 'lib/kudzu/agent/robots/txt.rb', line 14 def crawl_delay @crawl_delay end |
#rules ⇒ Object
Returns the value of attribute rules.
14 15 16 |
# File 'lib/kudzu/agent/robots/txt.rb', line 14 def rules @rules end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
14 15 16 |
# File 'lib/kudzu/agent/robots/txt.rb', line 14 def user_agent @user_agent end |
Instance Method Details
#allowed_path?(uri) ⇒ Boolean
21 22 23 24 25 26 |
# File 'lib/kudzu/agent/robots/txt.rb', line 21 def allowed_path?(uri) rules.each do |rule| return rule.allow if uri.path =~ rule.path end return true end |