class Nokogiri::XML::Node
Public Instance Methods
==(other)
click to toggle source
Determines if the node is similar to another node.
@return [Boolean]
Specifies whether the node is equal, in identity or value, to another node.
@api public
# File lib/nokogiri/ext/equality/node.rb, line 16 def ==(other) return false unless other (self.type == other.type) && (self.name == other.name) end
traverse_count()
click to toggle source
Calculates the sum of all children of the node.
@return [Integer]
The total number of children of the node.
@api public
# File lib/nokogiri/ext/traverse_count/node.rb, line 15 def traverse_count count = 0 traverse { |node| count += 1 } return count - 1 end
traverse_text() { |self| ... }
click to toggle source
Traverses all text nodes which are children of the node.
@yield [node]
A block will be passed each text node.
@yieldparam [Nokogiri::XML::Text] node
A text node.
@return [Enumerator]
If no block is given, an Enumerator object will be returned.
@api public
# File lib/nokogiri/ext/traverse_text.rb, line 21 def traverse_text return enum_for(:traverse_text) unless block_given? yield self if text? traverse do |node| yield node if node.text? end end