lib/wombat/iterator.rb in wombat-0.4.0 vs lib/wombat/iterator.rb in wombat-0.5.0
- old
+ new
@@ -8,17 +8,21 @@
end
def parse
raise ArgumentError.new('Must provide a block to locate property values') unless block_given?
- all_properties.each do |p|
+ all_properties.each do |p|
p.result ||= []
result = yield p
if result
result = p.callback ? p.callback.call(result) : result
p.result << result
end
end
+ end
+
+ def reset
+ all_properties.each { |p| p.reset }
end
def flatten(depth = nil)
# determine the iterator length by the biggest property array that we have
length = all_properties.map(&:result).sort { |a| a.length }.last.size
\ No newline at end of file