File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -329,18 +329,24 @@ def run node
329
329
330
330
keys = node . keys
331
331
return if keys . empty?
332
+ if keys == %w( hierarchy )
333
+ run_internal . call node [ 'hierarchy' ]
334
+ return
335
+ end
332
336
333
337
n_content = '@content-desc'
334
338
n_text = '@text'
335
339
n_class = '@class'
336
340
n_resource = '@resource-id'
337
341
n_node = 'node'
338
342
343
+ # Store the object if it has a content description, text, or resource id.
344
+ # If it only has a class, then don't save it.
339
345
obj = { }
340
346
obj . merge! ( { desc : node [ n_content ] } ) if keys . include? ( n_content ) && !node [ n_content ] . empty?
341
347
obj . merge! ( { text : node [ n_text ] } ) if keys . include? ( n_text ) && !node [ n_text ] . empty?
348
+ obj . merge! ( { resource_id : node [ n_resource ] } ) if keys . include? ( n_resource ) && !node [ n_resource ] . empty?
342
349
obj . merge! ( { class : node [ n_class ] } ) if keys . include? ( n_class ) && !obj . empty?
343
- obj . merge! ( { resource_id : node [ n_resource ] } ) if keys . include? ( n_resource ) && !obj . empty?
344
350
345
351
r . push obj if !obj . empty?
346
352
run_internal . call node [ n_node ] if keys . include? ( n_node )
@@ -371,7 +377,7 @@ def run node
371
377
out += " name: #{ e_desc } \n " unless e_desc . nil?
372
378
end
373
379
374
- out += " resource_id: #{ e_resource_id } \n " unless e_resource_id . nil?
380
+ out += " resource_id: #{ e_resource_id } \n " unless e_resource_id . nil? || e_resource_id . empty?
375
381
376
382
# there may be many ids with the same value.
377
383
# output all exact matches.
You can’t perform that action at this time.
0 commit comments