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

- old
+ new

@@ -299,9 +299,22 @@ end self.class.new(results.flatten, bindings) end ## + # Lists field names on this node. + # + # This can be useful in cases where the desired value is a key or child + # node label, rather than a value. + # + # @return [ValueArray] an array containing the field names. + # + # @see #select_child, #reject_child for methods that filter on these names + def field_names + self.class.new(flat_map(&:children).uniq, bindings) + end + + ## # Sets the top of the call chain to self and returns or yields self. # # This is syntactic sugar for `#bind(:top)`, with the addition of block # syntax. #