lib/nested_lookup.rb in nested_lookup-0.1.0 vs lib/nested_lookup.rb in nested_lookup-0.2.1
- old
+ new
@@ -152,10 +152,14 @@
document.each do |_key, value|
if value.instance_of? Hash
recrusion(document: value)
elsif value.instance_of? Array
value.each do |element|
- recrusion(document: element)
+ if element.eql? @keyword and @item.eql? 'value'
+ @result += 1
+ else
+ recrusion(document: element)
+ end
end
end
end
elsif document.instance_of? Array
document.each do |element|