bin/support/ruby/lib/commands/exercise/instructions.rb
# Write the given content to file
# @example
#   In ERB template:
#   <%
#     write_to_file('path/file.txt', 'content')
#   %>
# @param [String] path the path to write the file to.
# @param [Float] content the content to write to file
# @return [String] the path that the file was written to.
Write the given content to file
Write the given content to file
def write_to_file(path, content)
      directory = File.dirname(path)
      FileUtils.mkdir_p(directory)
      File.write(path, content)
      after_rendering_run("rm -rf #{path}")
      path
    end
def write_to_file ( path , content ) directory = File . dirname ( path ) FileUtils . mkdir_p ( directory ) File . write ( path , content ) after_rendering_run ( "rm -rf #{path}" ) path end
Write the given content to file
Write the given content to file
the path that the file was written to.
the path that the file was written to .
String
path
<not_specific>
content
<not_specific>
<not_specific>
content the content to write to file
content the content to write to file
example
In ERB template: <% write_to_file('path/file.txt', 'content') %>
In ERB template : <% write_to_file ( ' path / file . txt ' ' content ' ) % >