module RuboCop::AST::Descendence

def each_child_node(*types)

Returns:
  • (Enumerator) - if no block is given
  • (self) - if a block is given

Other tags:
    Yieldparam: node - each child node

Parameters:
  • type (Symbol) -- a node type

Overloads:
  • each_child_node(type, ...)
  • each_child_node
def each_child_node(*types)
  return to_enum(__method__, *types) unless block_given?
  children.each do |child|
    next unless child.is_a?(::AST::Node)
    yield child if types.empty? || types.include?(child.type)
  end
  self
end