lib/atp/ast/node.rb in atp-1.0.0 vs lib/atp/ast/node.rb in atp-1.1.0

- old
+ new

@@ -84,8 +84,15 @@ # Returns an array containing all flags which are set within the given node def set_flags Processors::ExtractSetFlags.new.run(self) end + + # Returns true if the node contains any nodes of the given type(s) or if any + # of its children do. + # To consider only direct children of this node use: node.find_all(*types).empty? + def contains?(*types) + !Extractor.new.process(self, types).empty? + end end end end