Module: Cuporter::Node::Sorting
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#sort! ⇒ Object
see #NodeSetExtensions in extensions/nokogiri.rb.
- #sort_all_descendants! ⇒ Object
Instance Method Details
#<=>(other) ⇒ Object
20 21 22 |
# File 'lib/cuporter/node/sorting.rb', line 20 def <=>(other) (short_cuke_name || name) <=> (other.short_cuke_name || other.name) end |
#sort! ⇒ Object
see #NodeSetExtensions in extensions/nokogiri.rb
14 15 16 17 18 |
# File 'lib/cuporter/node/sorting.rb', line 14 def sort! return unless has_children? sorted_children = children.sort self.children = sorted_children end |
#sort_all_descendants! ⇒ Object
8 9 10 11 |
# File 'lib/cuporter/node/sorting.rb', line 8 def sort_all_descendants! sort! children.each {|child| child.sort_all_descendants! } end |