def filter
      raise ArgumentError.new("A filter block is not given to the visitor filter method") unless block_given?
      self.class.new(@options) { |node| yield(node, node_children(node)) }
    end
def filter
      raise ArgumentError.new("A filter block is not given to the visitor filter method") unless block_given?
      self.class.new(@options) { |node| yield(node, node_children(node)) }
    end
Returns a new Visitor which determines which nodes to visit by applying the given block
 to this visitor. The filter block arguments consist of a parent node and an array of
 children nodes for the parent. The block can return nil, a single node to visit or a
 collection of nodes to visit.

 @example
   visitor = Jinx::Visitor.new { |person| person.children }
   # Joe has age 55 and children aged 17 and 24, who have children aged [1] and [6, 3], resp.
   visitor.to_enum(joe) { |person| person.age } #=> [55, 20, 1, 24, 6, 3]
   # The filter navigates to the children sorted by age of parents 21 or older.
   filter = visitor.filter { |parent, children| children.sort { |c1, c2| c1.age <=> c2.age } if parent.age >= 21 }
   filter.to_enum(joe) { |person| person.age } #=> [55, 24, 3, 6]

 @return [Visitor] the filter visitor
 @yield [parent, children] the filter to select which of the children to visit next
 @yieldparam parent the currently visited node
 @yieldparam [Array] children the nodes slated by this visitor to visit next
 @raise [ArgumentError] if a block is not given to this method