/Ruby_Exercises

Ordin project Ruby Exercises

Primary LanguageRuby

Ruby Basics Exercises

These exercises are designed to complement the Ruby Basic lessons on The Odin Project. Each folder contains exercises and specs (tests) for the lessons in the Ruby Basics section.

Usage

  1. First change directory into the lesson directory, for example cd 1_data_types.
  2. Run the tests for an exercise file, for example rspec spec/numbers_exercises_spec.rb. The first test will fail and the rest will be skipped.
  3. Open that corresponding exercise file in your text editor, in this case the exercises/numbers_exercises.rb file.
  4. Write the code to get the failing test to pass in the exercise file and run the tests again to verify it passes.
  5. Each exercises folder has a corresponding spec folder with matching test files. For instance, you can find the tests for exercises/numbers_exercises.rb in spec/numbers_exercises_spec.rb. Find and open the matching spec file.
  6. Unskip the next test by removing the x from xit.
  7. Run your tests again rspec spec/numbers_exercises_spec.rb the second test should now be failing.
  8. Repeat the steps from step 2 until no more tests are skipped and all are passing.

TIP: When there is only one exercise file in a directory (such as in 6_arrays) you can omit the path to the file and just enter rspec to run the tests in that file.

Contents

1.Basic Data Types

  • Numbers Exercises
  • Strings Exercises

6.Arrays

  • Array Exercises

7.Hashes

  • Hash Exercises

8.Methods

  • Method Exercises

9.Debugging

  • Debugging Exercises

10.Basic Enumerables

  • Basic Enumerable Exercises

11.Predicate Enumerables

  • Predicate Enumerable Exercises

12.Nested Collections

  • Nested Collection Exercises