def each_page(browsed_nodes: [], &block)
            return enum_for(__method__) { self.Count.to_i } unless block_given?

            if browsed_nodes.any?{|node| node.equal?(self)}
                raise InvalidPageTreeError, "Cyclic tree graph detected"
            end

            unless self.Kids.is_a?(Array)
                raise InvalidPageTreeError, "Kids must be an Array"
            end

            browsed_nodes.push(self)

            unless self.Count.nil?
                [ self.Count.value, self.Kids.length ].min.times do |n|
                    node = self.Kids[n].solve

                    case node
                    when PageTreeNode then node.each_page(browsed_nodes: browsed_nodes, &block)
                    when Page then yield(node)
                    else
                        raise InvalidPageTreeError, "not a Page or PageTreeNode"
                    end
                end
            end

            self
        end
def each_page(browsed_nodes: [], &block)
            return enum_for(__method__) { self.Count.to_i } unless block_given?

            if browsed_nodes.any?{|node| node.equal?(self)}
                raise InvalidPageTreeError, "Cyclic tree graph detected"
            end

            unless self.Kids.is_a?(Array)
                raise InvalidPageTreeError, "Kids must be an Array"
            end

            browsed_nodes.push(self)

            unless self.Count.nil?
                [ self.Count.value, self.Kids.length ].min.times do |n|
                    node = self.Kids[n].solve

                    case node
                    when PageTreeNode then node.each_page(browsed_nodes: browsed_nodes, &block)
                    when Page then yield(node)
                    else
                        raise InvalidPageTreeError, "not a Page or PageTreeNode"
                    end
                end
            end

            self
        end
Iterate through each page of that node.