def flatten_rules(root)
      root.children.each do |child|
        case child
        when Tree::RuleNode
          flatten_rule(child)
        when Tree::DirectiveNode
          flatten_rules(child)
        end
      end
    end
def flatten_rules(root)
      root.children.each do |child|
        case child
        when Tree::RuleNode
          flatten_rule(child)
        when Tree::DirectiveNode
          flatten_rules(child)
        end
      end
    end
Flatten rules so that

     foo
       bar
         color: red

 becomes

     foo bar
       color: red

 and

     foo
       &.bar
         color: blue

 becomes

     foo.bar
       color: blue

 @param root [Tree::Node] The parent node