kvmultiplex 0.1.7 → 0.1.8

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
  SHA1:
3
- metadata.gz: 993854d6cc7f82bf185322fde0aeba99cb66b66d
4
- data.tar.gz: 3bed16cd0684f35011616a737aa655ebc6f6c893
3
+ metadata.gz: 329461507efb6ab3f1d07f5d7b599520fa0646d2
4
+ data.tar.gz: 93d4d423675cb670fa8bdddf31057742f7aaa0f5
5
5
  SHA512:
6
- metadata.gz: 327e0127d4fd2583cc4560f4d2358cc706d92e35944e231347b8cd3bdb5ef95f55516bdb7c54410fb72cbec1752f93c7f2bcc29da1eb1b59b19dd7ec40c65753
7
- data.tar.gz: 8d3cd05ba746b3278806bb51d8d7ec77e790e3225d83916a0374cd1620312c95db5462c81633dbf27e061b346e67916a62965fe611d5e24a1de8d52d2286f866
6
+ metadata.gz: 397a7c3b416e45caae362be476fa12c9284db74193c17b6320084a6f2f85c816b43697dea9f497efe53e666ea853f1654177b52147ea560e95d8ae6993f29d60
7
+ data.tar.gz: fa1e8941497c7236360cdb429b41b9d3d114e945b22ad2ebef831413036ad5cb0d3fbdac9c9c04a1317546aacf90a5a2dea643085de40ee5647e88945cf0fa8a
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_runtime_dependency "diff-lcs", "~> 1.3"
28
28
  spec.add_runtime_dependency "deep_merge", "~> 1.1"
29
+ spec.add_runtime_dependency "multi_json", "~> 1"
29
30
  end
@@ -48,7 +48,10 @@ module KVMultiplex
48
48
  logger.warn "No providers for '#{full_key.inspect}'."
49
49
  nil
50
50
  else
51
- ret = providers.find { |provider| provider.get(subkey, full_key) }
51
+ ret =
52
+ providers.lazy
53
+ .map { |provider| provider.get(subkey, full_key) }
54
+ .find { |v| !v.nil? }
52
55
  logger.warn "No values found for '#{full_key.inspect}'." if ret.nil?
53
56
 
54
57
  ret
@@ -1,6 +1,6 @@
1
1
  require "kvmultiplex/provider"
2
2
 
3
- require "json"
3
+ require "multi_json" # because Chef uses json 1.8.old-as-heck
4
4
  require "deep_merge"
5
5
 
6
6
  module KVMultiplex
@@ -16,12 +16,12 @@ module KVMultiplex
16
16
 
17
17
  def get(subkey, _full_key)
18
18
  v = @contents[get_content_key(subkey)]
19
- v.nil? ? v : JSON.parse(v)
19
+ v.nil? ? v : MultiJson.load(v)
20
20
  end
21
21
 
22
22
  def set(subkey, _full_key, value)
23
23
  # do NOT use JSON.generate here; it's unsafe in environments that pull json 1.8.6
24
- @contents[get_content_key(subkey)] = value.nil? ? nil : value.to_json
24
+ @contents[get_content_key(subkey)] = value.nil? ? nil : MultiJson.dump(value)
25
25
  value
26
26
  end
27
27
 
@@ -1,3 +1,3 @@
1
1
  module KVMultiplex
2
- VERSION = "0.1.7".freeze
2
+ VERSION = "0.1.8".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kvmultiplex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ed Ropple
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: multi_json
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1'
97
111
  description:
98
112
  email:
99
113
  - ed@edropple.com