-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It turns out that ActionDispatch::Request no longer inherits from Rack::Request in Rails 5, so we had to add in direct support for ActionDispatch::Request.
- Loading branch information
Showing
6 changed files
with
22 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module VoightKampff::Methods | ||
def human? | ||
VoightKampff::Test.new(user_agent).human? | ||
end | ||
|
||
def bot? | ||
VoightKampff::Test.new(user_agent).bot? | ||
end | ||
alias :replicant? :bot? | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
# Reopen the Rack::Request class to add bot detection methods | ||
class Rack::Request | ||
def human? | ||
VoightKampff::Test.new(user_agent).human? | ||
end | ||
|
||
def bot? | ||
VoightKampff::Test.new(user_agent).bot? | ||
end | ||
alias :replicant? :bot? | ||
Rack::Request.class_eval do | ||
include VoightKampff::Methods | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters