Building a File Writer in Ruby
In this guide, you will walk through the steps to implement a method that writes a number of lines in a file.
Guide Tasks
  • Read Tutorial
  • Complete the Exercise

Summary

Build a method that writes lines in a file.

Exercise Description

For this code exercise, you will need to create a new file and put it in a file_path. You should then define a method that writes 1,000 lines in the file.

Example Data

fw = FileWriter.new(
      number_of_lines: 1000

Real World Usage

This exercise is useful to know because with only a few lines of code, you are able to implement a task that could have otherwise been time-consuming.

Test Cases

Code File