colinramsay-robotstxt 1.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +5 -1
  2. data/lib/robotstxtparser.rb +6 -3
  3. metadata +2 -2
data/README CHANGED
@@ -11,7 +11,11 @@ Disallow: /logs
11
11
  User-agent: Google
12
12
  Disallow: /admin
13
13
 
14
+ Use it like this:
15
+
16
+ require 'robotstxtparser'
17
+
14
18
  # Also accepts a local file
15
- rp = RobotsParser.new("http://something.com/robots.txt")
19
+ rp = RobotsTxtParser.new("http://something.com/robots.txt")
16
20
 
17
21
  rp.user_agents('Google') # returns ["/logs", "/admin"]
@@ -8,13 +8,16 @@ class RobotsTxtParser
8
8
  if path.include?("://")
9
9
  raw_data = open(path)
10
10
  else
11
- raw_data = File.open(path)
11
+ begin
12
+ raw_data = File.open(path)
13
+ rescue
14
+ end
12
15
  end
13
16
 
14
- return unless raw_data
15
-
16
17
  @user_agents = Hash.new
17
18
 
19
+ return unless raw_data
20
+
18
21
  parse(raw_data)
19
22
  end
20
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colinramsay-robotstxt
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.0"
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Ramsay
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-23 00:00:00 -07:00
12
+ date: 2009-06-30 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15