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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfff07475d5980342dfc27deaaa3eec31b566d29dd1abe67414cc4433de77a84
4
- data.tar.gz: 4ef6d17f8725d12525d5f6413daeaa32c5188dd4dbacf46cdc5e4d68544e97cf
3
+ metadata.gz: 48ff59f8719ebdb8b80437aa6bfcfb72cec7a901ca7e4884616b9fac25e92a10
4
+ data.tar.gz: 35171a35cea25e2ec5e27003aaca73efc7cbf0649e402aad26ed468fad48c8f2
5
5
  SHA512:
6
- metadata.gz: b1a66d9ac92279faf9929973999cf9f07d219aa2f16d6b03b1bbe66b4644bc4afbaa238b48a34144ed3c37732dd73af10168d49bf3358e95a7dabc9c730523f0
7
- data.tar.gz: 67f8534807574f2e95e53ddac24a651260efe82be49f816f0551424ff007a901e5a60702afaf178e5582c0e31330f2a8fcac497b3420ebe61f12b56d9eb14cca
6
+ metadata.gz: 3279cef8360fd63ea3df331aa84b7924132d7f29335e5ac1a1653d2e7b5acc76fd8d57268b88e93b02c438c9f690a38387e7c6adbd6bde585de0528157da5860
7
+ data.tar.gz: 27122813c6e978cb281bfe900086879eba353873f02795807df5f7f9b9b5f9614ad02b2029b1b1e6dcb0a6ab7130c86e2cb4d921e9a6647c076fb3ae172f2b52
@@ -21,28 +21,42 @@ module TrailGuide
21
21
  end
22
22
 
23
23
  def is_filtered_user_agent?
24
- return false if TrailGuide.configuration.filtered_user_agents.nil? || TrailGuide.configuration.filtered_user_agents.empty?
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
- TrailGuide.configuration.filtered_user_agents do |ua|
28
- return true if ua.class == String && request.user_agent == ua
29
- return true if ua.class == Regexp && request.user_agent =~ ua
30
- end
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
- return false
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 false if TrailGuide.configuration.filtered_ip_addresses.nil? || TrailGuide.configuration.filtered_ip_addresses.empty?
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
- TrailGuide.configuration.filtered_ip_addresses.each do |ip|
40
- return true if ip.class == String && request.ip == ip
41
- return true if ip.class == Regexp && request.ip =~ ip
42
- return true if ip.class == Range && ip.first.class == IPAddr && ip.include?(IPAddr.new(request.ip))
43
- end
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
- return false
56
+ return false
57
+ }
58
+ instance_exec(&@ip_address_filter_proc)
59
+ end
46
60
  end
47
61
 
48
62
  class HelperProxy
@@ -2,7 +2,7 @@ module TrailGuide
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 26
5
+ PATCH = 27
6
6
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
 
8
8
  class << self
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.26
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-21 00:00:00.000000000 Z
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
- rubyforge_project:
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