trailguide 0.1.26 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trail_guide/helper.rb +29 -15
- data/lib/trail_guide/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48ff59f8719ebdb8b80437aa6bfcfb72cec7a901ca7e4884616b9fac25e92a10
|
4
|
+
data.tar.gz: 35171a35cea25e2ec5e27003aaca73efc7cbf0649e402aad26ed468fad48c8f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3279cef8360fd63ea3df331aa84b7924132d7f29335e5ac1a1653d2e7b5acc76fd8d57268b88e93b02c438c9f690a38387e7c6adbd6bde585de0528157da5860
|
7
|
+
data.tar.gz: 27122813c6e978cb281bfe900086879eba353873f02795807df5f7f9b9b5f9614ad02b2029b1b1e6dcb0a6ab7130c86e2cb4d921e9a6647c076fb3ae172f2b52
|
data/lib/trail_guide/helper.rb
CHANGED
@@ -21,28 +21,42 @@ module TrailGuide
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def is_filtered_user_agent?
|
24
|
-
return
|
25
|
-
return false unless respond_to?(:request, true) && request.user_agent
|
24
|
+
return @is_filtered_user_agent unless @is_filtered_user_agent.nil?
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
@is_filtered_user_agent = begin
|
27
|
+
@user_agent_filter_proc ||= -> {
|
28
|
+
return false if TrailGuide.configuration.filtered_user_agents.nil? || TrailGuide.configuration.filtered_user_agents.empty?
|
29
|
+
return false unless respond_to?(:request, true) && request.user_agent
|
30
|
+
|
31
|
+
TrailGuide.configuration.filtered_user_agents.each do |ua|
|
32
|
+
return true if ua.class == String && request.user_agent == ua
|
33
|
+
return true if ua.class == Regexp && request.user_agent =~ ua
|
34
|
+
end
|
31
35
|
|
32
|
-
|
36
|
+
return false
|
37
|
+
}
|
38
|
+
instance_exec(&@user_agent_filter_proc)
|
39
|
+
end
|
33
40
|
end
|
34
41
|
|
35
42
|
def is_filtered_ip_address?
|
36
|
-
return
|
37
|
-
return false unless respond_to?(:request, true) && request.ip
|
43
|
+
return @is_filtered_ip_address unless @is_filtered_ip_address.nil?
|
38
44
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
45
|
+
@is_filtered_ip_address = begin
|
46
|
+
@ip_address_filter_proc ||= -> {
|
47
|
+
return false if TrailGuide.configuration.filtered_ip_addresses.nil? || TrailGuide.configuration.filtered_ip_addresses.empty?
|
48
|
+
return false unless respond_to?(:request, true) && request.ip
|
49
|
+
|
50
|
+
TrailGuide.configuration.filtered_ip_addresses.each do |ip|
|
51
|
+
return true if ip.class == String && request.ip == ip
|
52
|
+
return true if ip.class == Regexp && request.ip =~ ip
|
53
|
+
return true if ip.class == Range && ip.first.class == IPAddr && ip.include?(IPAddr.new(request.ip))
|
54
|
+
end
|
44
55
|
|
45
|
-
|
56
|
+
return false
|
57
|
+
}
|
58
|
+
instance_exec(&@ip_address_filter_proc)
|
59
|
+
end
|
46
60
|
end
|
47
61
|
|
48
62
|
class HelperProxy
|
data/lib/trail_guide/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailguide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rebec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -186,8 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
|
-
|
190
|
-
rubygems_version: 2.7.7
|
189
|
+
rubygems_version: 3.0.3
|
191
190
|
signing_key:
|
192
191
|
specification_version: 4
|
193
192
|
summary: User experiments for rails
|