lib/origami/pdf.rb in origami-2.0.3 vs lib/origami/pdf.rb in origami-2.0.4

- old
+ new

@@ -541,31 +541,31 @@ ########################## # # Iterates over the children of an object, avoiding cycles. # - def walk_object(object, excludes: []) + def walk_object(object, excludes: [], &block) return enum_for(__method__, object, excludes: excludes) unless block_given? return if excludes.include?(object) excludes.push(object) case object when Dictionary object.each_value do |value| yield(value) - walk_object(value, excludes: excludes) + walk_object(value, excludes: excludes, &block) end when Array object.each do |child| yield(child) - walk_object(child, excludes: excludes) + walk_object(child, excludes: excludes, &block) end when Stream yield(object.dictionary) - walk_object(object.dictionary, excludes: excludes) + walk_object(object.dictionary, excludes: excludes, &block) end end # # Searches through an object, possibly going into object streams.