ach_flattenmeta 0.1.0 → 0.2.0
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 +4 -4
- data/lib/ach_flattenmeta.rb +3 -38
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4f3d2d8d5f8becc807077436c77f57f539a13ceefd0216810a2b2a157e1fe0f
|
4
|
+
data.tar.gz: df52ed1217a58639a6b0146ae357c85d999b98b2db41046836f387c08978fc07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 891ec438ac4c92f21d3b865b8a1e854dcc558c65a4d8fe19fc25c78459c49b109a70f4c563ed6637ebea796e76a5d1f54b538c8f1fbfc9664b08f97b61fe46d3
|
7
|
+
data.tar.gz: ec1913aedfc0559147705ed40f83f8eaa440fec5d471f12e409de2a4fdfb0f9ad1449a31f1ae3cbcd75ae7c2043fa36168f9ad36bf1fb19038b720e384b44a2b
|
data/lib/ach_flattenmeta.rb
CHANGED
@@ -1,39 +1,4 @@
|
|
1
|
-
|
2
|
-
# First create a simple and flattened hash with
|
3
|
-
# k => { value, prio }
|
4
|
-
#
|
5
|
-
# This can be iterated over using each method provided
|
6
|
-
#
|
7
|
-
def initialize( os_version, node_environment, confhash)
|
8
|
-
@flatconf = Hash.new()
|
9
|
-
@os_version = os_version
|
10
|
-
@node_environment = node_environment
|
11
|
-
@confhash = confhash
|
12
|
-
end # initialize
|
1
|
+
# frozen_string_literal: true
|
13
2
|
|
14
|
-
|
15
|
-
|
16
|
-
@flatconf.each { |k,v | yield k, v['value'] if v['active'] }
|
17
|
-
end # each
|
18
|
-
|
19
|
-
private
|
20
|
-
def filter()
|
21
|
-
@confhash.each do | location, data|
|
22
|
-
if (data['metadata']['environments'] & [@node_environment, 'all']).any? &&
|
23
|
-
(data['metadata']['platforms'] & [@os_version, 'all']).any?
|
24
|
-
|
25
|
-
prio = data['metadata']['priority']
|
26
|
-
active = data['metadata']['active']
|
27
|
-
|
28
|
-
data.each do | k, v |
|
29
|
-
next if k == 'metadata'
|
30
|
-
if @flatconf.key?(k)
|
31
|
-
@flatconf[k] = { 'value' => v, 'priority' => prio, 'active' => active } if @flatconf[k]['priority'] > prio
|
32
|
-
else
|
33
|
-
@flatconf[k] = { 'value' => v, 'priority' => prio, 'active' => active }
|
34
|
-
end # if
|
35
|
-
end #each
|
36
|
-
end # if
|
37
|
-
end # each
|
38
|
-
end # def
|
39
|
-
end # class
|
3
|
+
require 'ach_flattenmeta/flattenmeta'
|
4
|
+
require 'ach_flattenmeta/version'
|