rdf-kv 0.1.4 → 0.1.5

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rdf/kv/version.rb +1 -1
  3. data/lib/rdf/kv.rb +15 -7
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ae8b165dd5ec6b9b0d5537be00fd9bdad78451db3a7d26004b83dc891e132f8
4
- data.tar.gz: 2e66180337cd279075ef50978b175c04799d1e3d22206c6d12cc1cfc55c31a31
3
+ metadata.gz: 2f175bc353d9957490f45693644270d8ce9d82392352fefa7e22534786ad5fc7
4
+ data.tar.gz: 2d795adc0b253f8644ec110c4c972af8af5439fa00268a5455211df4794e46b2
5
5
  SHA512:
6
- metadata.gz: 46fe633378e76f51b004b26c6e3ceea96acedd4ab64dcc2e2801cd71c771cb4e879a9d13e87133fd9be6c2119423d2be04369954919f10dbc86bccaa72345063
7
- data.tar.gz: b43fa6bf6d8106d67d016548c7313c41cebe883559fef3149c256727fb56a1f6af8646ec6064a5150115df560391db89ad65f940ddf38105f07202f13f4eb3c4
6
+ metadata.gz: 8a8a7542849b4d2f86fcbdf8bfe13da51deac88f436ad0238fc663e18e3afe3f9c547c774de45caa22d8e1f42ea7d54d05d0eacd740c2d07dd5dbac50361f4bf
7
+ data.tar.gz: 1bd0ec5aab7ab7dc88d8de63e09ebd05ddcdcd50ad20485336dcac25b14d85551565d39ef47d8915f0790cddf69b01cb06373a1b12d12a5db9d30036fa430940
@@ -1,5 +1,5 @@
1
1
  module RDF
2
2
  class KV
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
data/lib/rdf/kv.rb CHANGED
@@ -143,6 +143,8 @@ class RDF::KV
143
143
  k = queue.shift
144
144
  seen[k] = true
145
145
 
146
+ # warn "key: #{k}"
147
+
146
148
  vals = macros[k]
147
149
 
148
150
  # done and pending macros within the macros
@@ -154,18 +156,21 @@ class RDF::KV
154
156
 
155
157
  next unless deref
156
158
 
159
+ # warn "pair: #{pair}"
160
+
161
+ # see a few lines below where deref is replaced
157
162
  if deref.is_a? Array
158
163
  deref.each { |m| done[m] ? dm[m] = true : pm[m] = true }
159
164
  else
160
165
  m = {}
161
- val.scan(/#{MACRO}/o).compact.each do |x|
166
+ val.scan(/#{MACRO}/o).flatten.compact.each do |x|
162
167
  x = x.to_sym
163
168
  next unless macros[x]
164
169
  raise "Self-reference found: #{x}" if x == k
165
170
 
166
171
  m[x] = true
167
172
 
168
- done[m] ? dm[m] = true : pm[m] = true
173
+ done[x] ? dm[x] = true : pm[x] = true
169
174
  end
170
175
 
171
176
  # replace the deref flag with the elements to deref with
@@ -183,13 +188,16 @@ class RDF::KV
183
188
 
184
189
  # put the current key back on the queue but put the dependencies first
185
190
  queue = q + [k] + queue
191
+ warn "queue: #{queue}"
186
192
  next
187
193
  end
188
194
 
189
- unless dm.empty?
190
- done[k] = deref_content vals, done
191
- else
195
+ # warn vals.inspect
196
+
197
+ if dm.empty?
192
198
  done[k] = vals.map(&:first)
199
+ else
200
+ done[k] = deref_content vals.map(&:first), done
193
201
  end
194
202
 
195
203
  # remember to remove this guy or we'll loop forever
@@ -325,9 +333,9 @@ class RDF::KV
325
333
  # step 2: dereference all the macros (that asked to be dereferenced)
326
334
  begin
327
335
  macros = massage_macros macros
328
- rescue e
336
+ rescue Exception => e
329
337
  # XXX we should do something more here
330
- raise e
338
+ raise Error.new e
331
339
  end
332
340
 
333
341
  # step 3: apply special control macros (which modify self)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-kv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Taylor