fizx-robots 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/robots.rb +4 -3
  2. metadata +1 -1
data/lib/robots.rb CHANGED
@@ -3,9 +3,10 @@ require "uri"
3
3
  class Robots
4
4
  class ParsedRobots
5
5
  def initialize(uri)
6
- io = open(URI.join(uri.to_s, "/robots.txt"))
7
- return if io.content_type != "text/plain"
8
- return if io.status != ["200", "OK"]
6
+ io = open(URI.join(uri.to_s, "/robots.txt")) rescue nil
7
+ if !io || io.content_type != "text/plain" || io.status != ["200", "OK"]
8
+ io = StringIO.new("User-agent: *\nAllow: /\n")
9
+ end
9
10
 
10
11
  @other = {}
11
12
  @disallows = {}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fizx-robots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Maxwell