Module: NodeSetExtensions

Defined in:
lib/cuporter/extensions/nokogiri.rb

Instance Method Summary collapse

Instance Method Details

#eql?(other) ⇒ Boolean

value equivalence

Returns:

  • (Boolean)


33
34
35
36
37
38
39
40
# File 'lib/cuporter/extensions/nokogiri.rb', line 33

def eql?(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.eql?(other[i])
  end
  true
end

#sortObject



26
27
28
29
30
# File 'lib/cuporter/extensions/nokogiri.rb', line 26

def sort
  return self if empty?
  sorted = to_a.sort
  self.class.new(document, sorted)
end