class Nokogiri::XML::Document
Public Instance Methods
traverse_count()
click to toggle source
Calculates the sum of all sub-children of the document.
@return [Integer]
The total number of children and sub-children of the document. Returns `0` if the document has no root element.
@api public
# File lib/nokogiri/ext/traverse_count/document.rb, line 16 def traverse_count if root 1 + root.traverse_count else 0 end end