class Unparser::Writer::DynamicString::Heredoc

def emit

def emit
  emit_heredoc_body
  write(HEREDOC_FOOTER)
end

def emit_dynamic(child)

def emit_dynamic(child)
  write('#{')
  emit_dynamic_component(child.children.first)
  write('}')
end

def emit_dynamic_component(node)

def emit_dynamic_component(node)
  visit(node) if node
end

def emit_heredoc_body

def emit_heredoc_body
  children.each do |child|
    if n_str?(child)
      write(escape_dynamic(child.children.first))
    else
      emit_dynamic(child)
    end
  end
end

def escape_dynamic(string)

def escape_dynamic(string)
  string.gsub('#', '\#')
end