lib/csl/node.rb in csl-1.2.3 vs lib/csl/node.rb in csl-1.3.0

- old
+ new

@@ -473,13 +473,14 @@ def quotes? attribute?(:'quotes') && !!(attributes[:'quotes'].to_s =~ /^true$/i) end def <=>(other) + return nil unless other.is_a?(Node) + return 1 if other.textnode? + [nodename, attributes, children] <=> [other.nodename, other.attributes, other.children] - rescue - nil end # Returns the node' XML tags (including attribute assignments) as an # array of strings. def tags @@ -599,9 +600,16 @@ text.nil? || text.empty? end def tags ["<#{attribute_assignments.unshift(nodename).join(' ')}>#{to_s}</#{nodename}>"] + end + + def <=>(other) + return nil unless other.is_a?(Node) + return -1 unless other.textnode? + + [nodename, attributes, text] <=> [other.nodename, other.attributes, other.text] end def inspect "#<#{[self.class.name, text.inspect, *attribute_assignments].join(' ')}>" end