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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f8d0361a7bc2ba9a9f0592163c75412323e05f8176fccfc2b26449222a755c7
4
- data.tar.gz: '031648bb9feb9b389f8d79f1a0b9fbe2975417116a30449165f09edf34cb627d'
3
+ metadata.gz: 1896ce13e6cb3eb66dae38e32281efd3e41d28812297eb03cbb0c70e568b1ea8
4
+ data.tar.gz: 81cd7eae5d7c4f9960a448bf9478c482061b215b5d050212a136078eb9dcf396
5
5
  SHA512:
6
- metadata.gz: '094371d751166f66599f75f7e9199602130110343df39a0872327650b1198a042abcbf469da8ea78945323aeee5a7cfbd4ab8f7ad3a62cd97c9760bc4be5a7db'
7
- data.tar.gz: 364b2612168f4223cd3752409c5dd8e6e678b6dc0d047c47c95579588f097ff8bc2b40f9caacc034bb2a0aceb52eacf5d174a88429ad4dd6c16014f128c5087c
6
+ metadata.gz: bb1cf75feadaf35b81d7af01d001dc7f5241d4c1ab5942318f40b94c9e7c0dd79fe0eec6c28bc1182270429874882af1fad2ba5b47559bba5cf1cf62417db66e
7
+ data.tar.gz: 991c0cc027d9f901eea39d691848d2846a4161676ff7f3cc08db337785019fa7195e358e82572c946ca56fd5cd00d5b24c34842124e8b8ee20c8ac9bcf39e454
@@ -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] << value
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.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.146
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-02-21 00:00:00.000000000 Z
11
+ date: 2020-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake