Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check with defined? to automatically load extensions #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ Installation

`gem install voight_kampff`

If you're using Rails and want to add `ActionDispatch::Request#bot?` and `ActionDispatch::Request#human?` methods, require `voight_kampff/rails`:

```Gemfile
gem 'voight_kampff', require: 'voight_kampff/rails'
```

if you're using pure Rack, require it the following way:

```Gemfile
gem 'voight_kampff', require: 'voight_kampff/rack'
```

Configuration
-------------

Expand Down Expand Up @@ -62,23 +50,6 @@ In general the `#bot?` command tends to include all of these and I'm sure it's u

Also, the gem no longer extends `ActionDispatch::Request` instead it extends `Rack::Request` which `ActionDispatch::Request` inherits from. This allows the same functionality for Rails while opening the gem up to other rack-based projects.

Upgrading to version 2.0
------------------------

If you use Rails and `ActionDispatch::Request#bot?` and `ActionDispatch::Request#human?` methods, change your gemfile:

```diff
-gem 'voight_kampff'
+gem 'voight_kampff', require: 'voight_kampff/rails'
```

If you use Rack, change your gemfile:

```diff
-gem 'voight_kampff'
+gem 'voight_kampff', require: 'voight_kampff/rack'
```

FAQ
---
__Q:__ __What's with the name?__
Expand Down
3 changes: 3 additions & 0 deletions lib/voight_kampff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ def test(user_agent_string)
end
end
end

require 'voight_kampff/rack' if defined?(Rack)
require 'voight_kampff/rails' if defined?(Rails::Railtie)