rails_hq_ip_whitelist 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ede5cc5537c1895b6659d6afb4f879eb1e291095
4
- data.tar.gz: 54b9c4297dcc62f175f89753996fafc7b14bd9f1
3
+ metadata.gz: 43ff93c4c0cb8c174b8c427aa7e8e21eec267aea
4
+ data.tar.gz: 9b985f1ce588aaebe20beab6b4d85618de3efbfb
5
5
  SHA512:
6
- metadata.gz: d359a828dff3d9441c24b956b9c35a59025462d118ee6e72362a62ad777a03137874831eeb8c5cdee2a498f5e8bee47478ac852250b27b281287c47a1d423449
7
- data.tar.gz: 3a10edc8b853b4c4d188b52356d57b2a8920a607a37809a7775715d1e155acb1e2516e2a537bf9e4d8be12786be1906b80bdc7b6c226b808a438352b3b2a908f
6
+ metadata.gz: 244810dde9855922365df8ca7c5713d521446e2a4fefd62f8e690286c596014f4ba94ad0d408ddafaf4356ea6447757f9133e856f2bc4024b56d2d9e08b730de
7
+ data.tar.gz: c0ef60aa25b96789b547efae71a3cd29e4544f089fc9735dc92fa6a484b23f9400b2bac66be06715d95e82ca78217cfb6c8034bb2ea7bb6ba6ca01cb2093b463
@@ -13,7 +13,7 @@ module IPWhitelist
13
13
 
14
14
  Rails.logger.info("#{current_user.username}'s IP (#{ip}) is not in authorized list (#{current_user.ip_whitelist.join(", " )})")
15
15
 
16
- if redirect = IPWhitelist.configuration.redirect
16
+ if redirect = IPWhitelist.redirect
17
17
  redirect_to redirect
18
18
  else
19
19
  render text: "Not Authorized", status: 401
@@ -1,3 +1,3 @@
1
1
  module IPWhitelist
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
@@ -1,17 +1,21 @@
1
1
  require "ip_whitelist/controller"
2
2
  module IPWhitelist
3
- Configuration = Struct.new(:redirect)
4
3
 
5
- class << self
6
- attr_writer :configuration
4
+ def self.config
5
+ @config ||= ::ActiveSupport::OrderedOptions.new
7
6
  end
8
7
 
9
- def self.configuration
10
- @configuration ||= Configuration.new
8
+ def self.configure(&block)
9
+ config.instance_eval(&block)
11
10
  end
12
11
 
13
- def self.configure
14
- yield(configuration)
12
+ def self.redirect
13
+ @redirect ||=
14
+ if config.redirect.is_a?(Proc)
15
+ config.redirect.call
16
+ else
17
+ config.redirect
18
+ end
15
19
  end
16
20
 
17
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_hq_ip_whitelist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendan Carney
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-13 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails