reinforce 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: b82c7c72df9adcff276fa371cb5c8d953cbdd6ca9a539699e721ee7a77c38008
4
- data.tar.gz: b1448e586008e393b8340fe4f3eaa6229f1a26fdc0e4005d0b4531472a5bcee6
3
+ metadata.gz: d6f784fce6717c12f407633dbb56dba404570e9e45da8ba600f6262fa9002e23
4
+ data.tar.gz: ffe9f04192a29a941cc34e6bd77e1588100596c0fa8157c2627ceacd2a8df35b
5
5
  SHA512:
6
- metadata.gz: 960628d6ec125a2e4f08ad0e910f2204942d2c4eb75ebf27fb6f4ed3f3ffd673cdbfcd44aa060abf8873ccf48381a96491411ae839848655c3c63681d01a8e9d
7
- data.tar.gz: 1dfa500def6c6de0cc24e106ebfeb36f2235d53f442cdd87226e8d3338e5b4bfc05d308dfe76cd3f48a627afd863cf125a9d4dffc96fd49af6b5f0cd6448b11b
6
+ metadata.gz: 05e6126e4f9a9877bb925f386374abd8b64761ec993e80092d54eb5f5cdc4edb725eeda3f507bce260d5cf15b2872b0511b0cfd675516b6560bc05541a643c8b
7
+ data.tar.gz: 6d32147351c0c512bb9bdaaa0b28e1b1734b4fd5839209ba58934fe7a441a65ccfac8d482052950b26e4f07274bc44e4d612226bf782a8914bf5c078ad4705ed
@@ -80,14 +80,48 @@ module Reinforce
80
80
  return nil if build.nil?
81
81
 
82
82
  build = last_build if build == LATEST_BUILD
83
- @pbgid_keyed.dig(build, pbgid) || get_by_pbgid(pbgid, build: previous_build_for(build))
83
+
84
+ cursor = build
85
+ until cursor.nil?
86
+ value = @pbgid_keyed.dig(cursor, pbgid)
87
+ return value unless value.nil?
88
+
89
+ cursor = previous_build_for(cursor)
90
+ end
91
+
92
+ cursor = next_build_for(build)
93
+ until cursor.nil?
94
+ value = @pbgid_keyed.dig(cursor, pbgid)
95
+ return value unless value.nil?
96
+
97
+ cursor = next_build_for(cursor)
98
+ end
99
+
100
+ nil
84
101
  end
85
102
 
86
103
  def get_by_path(path, build: LATEST_BUILD)
87
104
  return nil if build.nil?
88
105
 
89
106
  build = last_build if build == LATEST_BUILD
90
- @path_keyed.dig(build, path) || get_by_path(path, build: previous_build_for(build))
107
+
108
+ cursor = build
109
+ until cursor.nil?
110
+ value = @path_keyed.dig(cursor, path)
111
+ return value unless value.nil?
112
+
113
+ cursor = previous_build_for(cursor)
114
+ end
115
+
116
+ cursor = next_build_for(build)
117
+ until cursor.nil?
118
+ value = @path_keyed.dig(cursor, path)
119
+ return value unless value.nil?
120
+
121
+ cursor = next_build_for(cursor)
122
+ end
123
+
124
+ nil
91
125
  end
92
126
 
93
127
  def populate(build, data, rehash: true)
@@ -135,6 +169,10 @@ module Reinforce
135
169
  @pbgid_keyed.keys.sort.reverse.find { |b| b < build }
136
170
  end
137
171
 
172
+ def next_build_for(build)
173
+ @pbgid_keyed.keys.sort.find { |b| b > build }
174
+ end
175
+
138
176
  def rehash(hash)
139
177
  previous = nil
140
178
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reinforce
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reinforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryantaylor