Method: Nokogiri::XML::NodeSet#==

Defined in:
lib/nokogiri/xml/node_set.rb

#==(other) ⇒ Object

Equality – Two NodeSets are equal if the contain the same number of elements and if each element is equal to the corresponding element in the other NodeSet

[View source] [View on GitHub]

395
396
397
398
399
400
401
402
403
# File 'lib/nokogiri/xml/node_set.rb', line 395

def ==(other)
  return false unless other.is_a?(Nokogiri::XML::NodeSet)
  return false unless length == other.length

  each_with_index do |node, i|
    return false unless node == other[i]
  end
  true
end