rbbt-util 5.26.146 → 5.26.147
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/util/config.rb +2 -2
- data/test/rbbt/util/test_config.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1896ce13e6cb3eb66dae38e32281efd3e41d28812297eb03cbb0c70e568b1ea8
|
4
|
+
data.tar.gz: 81cd7eae5d7c4f9960a448bf9478c482061b215b5d050212a136078eb9dcf396
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb1cf75feadaf35b81d7af01d001dc7f5241d4c1ab5942318f40b94c9e7c0dd79fe0eec6c28bc1182270429874882af1fad2ba5b47559bba5cf1cf62417db66e
|
7
|
+
data.tar.gz: 991c0cc027d9f901eea39d691848d2846a4161676ff7f3cc08db337785019fa7195e358e82572c946ca56fd5cd00d5b24c34842124e8b8ee20c8ac9bcf39e454
|
data/lib/rbbt/util/config.rb
CHANGED
@@ -76,7 +76,7 @@ module Rbbt::Config
|
|
76
76
|
next if prio > best_prio
|
77
77
|
next unless tok == token
|
78
78
|
priorities[prio] ||= []
|
79
|
-
priorities[prio]
|
79
|
+
priorities[prio].unshift value
|
80
80
|
end
|
81
81
|
end if entries
|
82
82
|
priorities
|
@@ -111,7 +111,7 @@ module Rbbt::Config
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
-
value = priorities.empty? ? default : priorities.collect{|p| p }.sort_by{|p,v| p}.first.last.
|
114
|
+
value = priorities.empty? ? default : priorities.collect{|p| p }.sort_by{|p,v| p}.first.last.first
|
115
115
|
value = false if value == 'false'
|
116
116
|
|
117
117
|
Log.debug "Value #{value.inspect} for config key '#{ key }': #{tokens * ", "}"
|
@@ -30,5 +30,18 @@ class TestConfig < Test::Unit::TestCase
|
|
30
30
|
assert_equal "valueA", Rbbt::Config.get('key', 'token')
|
31
31
|
assert_equal "default", Rbbt::Config.get('key2', 'token', :default => 'default')
|
32
32
|
end
|
33
|
+
|
34
|
+
def test_order
|
35
|
+
Rbbt::Config.add_entry 'key', 'V1', 'token1'
|
36
|
+
Rbbt::Config.add_entry 'key', 'V2', 'token2'
|
37
|
+
Rbbt::Config.add_entry 'key', 'V3', 'token2'
|
38
|
+
|
39
|
+
assert_equal "V3", Rbbt::Config.get('key', 'token2')
|
40
|
+
assert_equal "V1", Rbbt::Config.get('key', 'token1')
|
41
|
+
assert_equal "V3", Rbbt::Config.get('key', 'token2', 'token1')
|
42
|
+
assert_equal "V1", Rbbt::Config.get('key', 'token1', 'token2')
|
43
|
+
end
|
44
|
+
|
45
|
+
|
33
46
|
end
|
34
47
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.26.
|
4
|
+
version: 5.26.147
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|