vendor/bundle/ruby/3.0.0/gems/rubocop-ast-1.16.0/lib/rubocop/ast/node.rb
# Calls the given block for each ancestor node from parent to root.
# If no block is given, an `Enumerator` is returned.
#
# @overload each_ancestor
#   Yield all nodes.
# @overload each_ancestor(type)
#   Yield only nodes matching the type.
#   @param [Symbol] type a node type
# @overload each_ancestor(type_a, type_b, ...)
#   Yield only nodes matching any of the types.
#   @param [Symbol] type_a a node type
#   @param [Symbol] type_b a node type
# @yieldparam [Node] node each ancestor node
# @return [self] if a block is given
# @return [Enumerator] if no block is given
Calls the given block for each ancestor node from parent to root.
If no block is given, an `Enumerator` is returned.
Calls the given block for each ancestor node from parent to root . If no block is given an ` Enumerator ` is returned .
def each_ancestor(*types, &block)
        return to_enum(__method__, *types) unless block
        visit_ancestors(types, &block)
        self
      end
def each_ancestor ( * types , & block ) return to_enum ( __method__ , * types ) unless block visit_ancestors ( types , & block ) self end
Calls the given block for each ancestor node from parent to root.
Calls the given block for each ancestor node from parent to root .
if a block is given
if a block is given
self
if no block is given
if no block is given
Enumerator
types
block
node each ancestor node
node each ancestor node
overload
each_ancestor Yield all nodes.
each_ancestor Yield all nodes .
overload
each_ancestor(type) Yield only nodes matching the type. @param [Symbol] type a node type
each_ancestor ( type ) Yield only nodes matching the type . @param [ Symbol ] type a node type
overload
each_ancestor(type_a, type_b, ...) Yield only nodes matching any of the types. @param [Symbol] type_a a node type @param [Symbol] type_b a node type
each_ancestor ( type_a type_b ... ) Yield only nodes matching any of the types . @param [ Symbol ] type_a a node type @param [ Symbol ] type_b a node type