crawler_detect 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 342d96d8f386511a05e7ab0894faefca3ea74a60910f378c2b5c1ab26bd530a8
4
- data.tar.gz: 5fb6e1759b67aeb2e2d644d6c48141ad02c3c74663a31468ae2f4c53b69df0fe
3
+ metadata.gz: 97314f6307705c0123a25333340c7509138cd8991eb1946a52d66c99df08ddac
4
+ data.tar.gz: 135a67b8502348dde1c86dd0e17e894dceafeb61b8acb74487f3d6e1832954e0
5
5
  SHA512:
6
- metadata.gz: 9ed795dd180037e8a131bc05b3a176488b70601373daabbd459a0f3c21bc49a240eaac4518148c50dc14bd5edd46f92f62e70453c2cbfd0d85002e3cdfc9dbdc
7
- data.tar.gz: 1e30cad0d3588db6a89fb95b04e5e09166a9742acc33f14c2dce2d56c25b5578f12e3c572dc2c1401fccf5d526518b851ce41f79e0a3b00f9ef6b361718ad14f
6
+ metadata.gz: 1f6dc6ef31c358ce0a5e94469971021ba5a1e1c8ba9133836e839053e4717c32d94a0c3dbb2d828ada989192f70e85d899ad87b9b56f0e26ef33f08d45209112
7
+ data.tar.gz: ed8cf6c609fe3b7e3102d9a6d60358d9e80e19f69b1a8c4b218bc929642991389e40fecf48c5de69975d76373b1406b7a89e1c9ec5ccdf2dd727710eb3363524
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CrawlerDetect
4
- VERSION = "0.1.10"
4
+ VERSION = "0.1.11"
5
5
  end
@@ -16,25 +16,25 @@ module Rack
16
16
  end
17
17
 
18
18
  def call(env)
19
- @env = env
20
- set_env_variables!
21
- @app.call(@env)
19
+ set_env_variables!(env)
20
+ @app.call(env)
22
21
  end
23
22
 
24
23
  private
25
24
 
26
- def set_env_variables!
27
- return @env unless user_agent
28
- detector = ::CrawlerDetect::Detector.new(user_agent)
29
- @env["rack.crawler_detect"] = {
25
+ def set_env_variables!(env)
26
+ ua = user_agent(env)
27
+ return unless ua
28
+ detector = ::CrawlerDetect::Detector.new(ua)
29
+ env["rack.crawler_detect"] = {
30
30
  is_crawler: detector.is_crawler?,
31
31
  crawler_name: detector.crawler_name,
32
32
  }
33
33
  end
34
34
 
35
- def user_agent
35
+ def user_agent(env)
36
36
  user_agent_headers.map do |header|
37
- @env[header]
37
+ env[header]
38
38
  end.compact.join(" ")
39
39
  end
40
40
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crawler_detect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kozlov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-16 00:00:00.000000000 Z
11
+ date: 2019-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -165,8 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []
168
- rubyforge_project:
169
- rubygems_version: 2.7.6
168
+ rubygems_version: 3.0.6
170
169
  signing_key:
171
170
  specification_version: 4
172
171
  summary: 'CrawlerDetect: detect bots/crawlers'