lib/krikri/parser.rb in krikri-0.13.2 vs lib/krikri/parser.rb in krikri-0.14.0

- old
+ new

@@ -447,10 +447,19 @@ def match_attribute(name, other = nil, &block) select(&compare_to_attribute(name, other, &block)) end ## + # @param *children [Array<String>] + # + # @return [ValueArray] an array containing nodes for which the specified + # attribute does not have a child node matching the given child name + def match_child(*children) + select { |v| !(v.children & children).empty? } + end + + ## # @param name [#to_sym] an attribute name # @param other [Object] an object to check for equality with the # values from the given attribute. # # @yield [value] yields each value with the attribute in name to the block @@ -461,9 +470,18 @@ # # @see #match_attribute for examples; this calls #reject, where it calls # #select. def reject_attribute(name, other = nil, &block) reject(&compare_to_attribute(name, other, &block)) + end + + ## + # @param *children [Array<String>] + # + # @return [ValueArray] an array containing nodes for which the specified + # attribute does not have a childnode matching the given child name + def reject_child(*children) + reject { |v| !(v.children & children).empty? } end ## # Wraps the root node of the given record in this class. #