Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bumped version number

  • Loading branch information...
commit 0c5fa9fbef47ce37c1b61287e8e3ebfe75131abf 1 parent 2cc0c64
Genki Takiuchi authored
9 README.md
View
@@ -0,0 +1,9 @@
+Rack Turing Test
+================
+
+The bot detector for Rack::Request
+
+USAGE
+-----
+
+ request.bot? #=> true or false
24 lib/rack-turing-test.rb
View
@@ -1,9 +1,27 @@
require "rack-turing-test/version"
module Rack
- module Turing
- module Test
- # Your code goes here...
+ module TuringTest
+ PATTERN = Regexp.union(
+ /googlebot/i,
+ /mediapartners-google/i,
+ /slurp/i,
+ /ask.com/i,
+ /crawler/i,
+ /nutch/i,
+ /msnbot/i,
+ /bingbot/i,
+ /baidu/i,
+ /yetibot/i,
+ /teoma/i,
+ ).freeze
+
+ def bot?
+ !!user_agent.match(PATTERN)
end
end
+
+ class Request
+ include TuringTest
+ end
end
6 lib/rack-turing-test/version.rb
View
@@ -1,7 +1,5 @@
module Rack
- module Turing
- module Test
- VERSION = "0.0.1"
- end
+ module TuringTest
+ VERSION = "0.1.0"
end
end
2  rack-turing-test.gemspec
View
@@ -4,7 +4,7 @@ require "rack-turing-test/version"
Gem::Specification.new do |s|
s.name = "rack-turing-test"
- s.version = Rack::Turing::Test::VERSION
+ s.version = Rack::TuringTest::VERSION
s.authors = ["Genki Takiuchi"]
s.email = ["genki@s21g.com"]
s.homepage = ""
Please sign in to comment.
Something went wrong with that request. Please try again.