Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] Update Markdown files to latest spec #2

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Exercism Exercises in Ruby

#### Table of Contents
## Table of Contents
- [Setup](#setup)
- [Anatomy of an Exercise](#anatomy-of-an-exercise)
- [Canonical Data](#canonical-data)
Expand Down
2 changes: 2 additions & 0 deletions concepts/arrays/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

Data structures that can hold zero or more elements are known as _collections_. An **array** in Ruby is a collection that maintains the ordering in which its objects are added. Arrays can hold any object. Objects can be added to an array or retrieved from it using an index. Ruby array indexing is zero-based, meaning that the first element's index is always zero:

```ruby
Expand Down
2 changes: 2 additions & 0 deletions concepts/arrays/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

In Ruby, **arrays** are ordered, integer-indexed collections of any object. Array indexing starts at `0`. A negative index is assumed to be relative to the end of the array — i.e. an index of `-1` indicates the last element of the array, `-2` is the next to last element in the array, and so on.
Ruby arrays mix in the [Enumerable module][enumerable-module], which adds several traversal and searching methods, and with the ability to sort.

Expand Down
2 changes: 2 additions & 0 deletions concepts/basics/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

Ruby is a dynamic and strongly typed language. In dynamic languages the type of a variable or object is resolved at runtime, which means that its value or type can be changed up to the very last moment (when it gets parsed by the interpreter).
And what do we mean with strongly typed? Once we know the type of a variable or object, Ruby is strict about what you can do with it, for example:

Expand Down
2 changes: 2 additions & 0 deletions concepts/basics/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

Ruby is a dynamic [object-oriented language][object-oriented-programming]. Everything in Ruby is an [object][object].

There are two primary ways to assign objects to names in Ruby - using variables or constants. Variables are always written in [snake case][snake-case]. A variable can reference different objects over its lifetime. For example, `my_first_variable` can be defined and redefined many times using the `=` operator:
Expand Down
2 changes: 2 additions & 0 deletions concepts/blocks/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

Blocks are small groupings of statements that can be executed multiple times.
They can be thought of as closures or anonymous functions.
Blocks are defined using the `do...end` syntax (above), or the `{}` (below).
Expand Down
2 changes: 2 additions & 0 deletions concepts/blocks/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

Blocks are small groupings of statements that can be executed multiple times.
They can be thought of as closures or anonymous functions.
Blocks are defined using the `do...end` syntax (above), or the `{}` (below).
Expand Down
2 changes: 2 additions & 0 deletions concepts/booleans/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

## True, False

- `true` and `false` are used to represent boolean logical states.
Expand Down
2 changes: 2 additions & 0 deletions concepts/booleans/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

## True and False

True and false logical states are represented with `true` and `false` in Ruby. These may either be used as literals on their own, or as a result of logical or comparison methods.
Expand Down
2 changes: 2 additions & 0 deletions concepts/classes/about.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# About

TODO: add information on classes concept
2 changes: 2 additions & 0 deletions concepts/classes/introduction.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Introduction

TODO: add introduction for classes concept
2 changes: 2 additions & 0 deletions concepts/conditionals/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

An `if` statement can be used to conditionally execute code:

```ruby
Expand Down
2 changes: 2 additions & 0 deletions concepts/conditionals/introduction.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Introduction

TODO: Write this
2 changes: 2 additions & 0 deletions concepts/enumeration/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

Enumeration is the act of stepping through a collection (`Array`, `Hash`, etc) and performing some action on each object.

Enumeration is a key concept in Ruby and is used for sorting (`sort_by`), grouping (`group_by`), mapping (`map`), reducing (`reduce`), and much more.
Expand Down
2 changes: 2 additions & 0 deletions concepts/enumeration/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

Enumeration is the act of stepping through a collection (`Array`, `Hash`, etc) and performing some action on each object.

Enumeration is a key concept in Ruby and is used for sorting (`sort_by`), grouping (`group_by`), mapping (`map`), reducing (`reduce`), and much more.
Expand Down
2 changes: 2 additions & 0 deletions concepts/exceptions/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

It is important to note that exceptions should be used in cases where something exceptional happens, an error that needs special handling. Exceptions should not be used for control-flow of a program, as that is considered bad design, which often leads to bad performance and maintainability.

In Ruby exceptions follow a class hierarchy where `Exception` is the base class. These are the most common Ruby's built-in exceptions:
Expand Down
2 changes: 2 additions & 0 deletions concepts/exceptions/introduction.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Introduction

TODO: Write this
8 changes: 5 additions & 3 deletions concepts/floating-point-numbers/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

A floating-point number is a number with zero or more digits behind the decimal separator. Examples are `4.0`, `0.1`, `3.14`, `-6.4` `16.984025` and `1024.0`. In Ruby, floating-point numbers are implemented through the [Float](https://ruby-doc.org/core-2.7.0/Float.html) class.

You can find a short introduction to floating-point numbers at [0.30000000000000004.com][0.30000000000000004.com].
Expand All @@ -8,7 +10,7 @@ To repeatedly execute logic, one can use loops. In this example the `while` loop

The `#years_before_desired_balance` method from the previous exercise could have been written by using any of the three mentioned loops:

### `while`
## `while`

```ruby
def self.years_before_desired_balance(current_balance, desired_balance)
Expand All @@ -21,7 +23,7 @@ def self.years_before_desired_balance(current_balance, desired_balance)
end
```

### `until`
## `until`

```ruby
def self.years_before_desired_balance(current_balance, desired_balance)
Expand All @@ -34,7 +36,7 @@ def self.years_before_desired_balance(current_balance, desired_balance)
end
```

### `loop`
## `loop`

```ruby
def self.years_before_desired_balance(current_balance, desired_balance)
Expand Down
2 changes: 1 addition & 1 deletion concepts/floating-point-numbers/introduction.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Loops
# Loops

A floating-point number is a number with zero or more digits behind the decimal separator. Examples are `4.0`, `0.1`, `3.14`, `-6.4` `16.984025` and `1024.0`.
In Ruby, floating-point numbers are implemented through the [Float](https://ruby-doc.org/core-2.7.0/Float.html) class.
Expand Down
2 changes: 2 additions & 0 deletions concepts/instance-variables/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

## Key Points:

- When a class' `.new` method is called to create an object instance, the `.initialize` method is passed all arguments to initialize the instance's state.
Expand Down
2 changes: 2 additions & 0 deletions concepts/instance-variables/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

Objects can hold their own state by setting _instance variables_, which are created by prefixing `@` to a variable name.

```ruby
Expand Down
2 changes: 2 additions & 0 deletions concepts/loops/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

## `while`

```ruby
Expand Down
2 changes: 2 additions & 0 deletions concepts/loops/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

A floating-point number is a number with zero or more digits behind the decimal separator. Examples are `4.0`, `0.1`, `3.14`, `-6.4` `16.984025` and `1024.0`.
In Ruby, floating-point numbers are implemented through the [Float](https://ruby-doc.org/core-2.7.0/Float.html) class.

Expand Down
2 changes: 2 additions & 0 deletions concepts/nil/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

## Key Points:

- When a class' `.new` method is called to create an object instance, the `.initialize` method is passed all arguments to initialize the instance's state.
Expand Down
2 changes: 2 additions & 0 deletions concepts/nil/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction


[Nil][nil-dictionary] is an English word meaning "nothing" or "zero". In Ruby, `nil` is used to express the _absence_ of an object. In other programming languages, `null` or `none` values may play a similar role.

Expand Down
2 changes: 2 additions & 0 deletions concepts/numbers/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

One of the key aspects of working with numbers in Ruby is the distinction between integers (numbers with no digits after the decimal separator) and floating-point numbers (numbers with zero or more digits after the decimal separator).
They are implemented through the [`Integer`][integer-ruby] and [`Float`][float-ruby] class.

Expand Down
2 changes: 2 additions & 0 deletions concepts/numbers/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

Two common types of numbers in Ruby are:

- Integers: numbers with no digits behind the decimal separator (whole numbers). Examples are `-6`, `0`, `1`, `25`, `976` and `500000`.
Expand Down
2 changes: 2 additions & 0 deletions concepts/ostruct/after.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# After

Ruby comes with a Standard Library (often shortened to "stdlib") - a collection of classes for working with things such as dates, json, and networking.
It also provides some useful functionality for making your code easier to work with.

Expand Down
2 changes: 2 additions & 0 deletions concepts/ostruct/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

Ruby comes with a Standard Library (often shortened to "stdlib") - a collection of classes for working with things such as dates, json, and networking.
It also provides some useful functionality for making your code easier to work with.

Expand Down
2 changes: 2 additions & 0 deletions concepts/strings/about.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

The key thing to remember about Ruby strings is that they are objects that you call methods on. You can find all the methods in the [Ruby docs][ruby-doc.org-string]

It's also worth knowing that strings can be created using single quotes (`'`) or double quotes (`"`). Single-quoted strings don't process ASCII escape codes(\n, \t etc.), and they don't do [string interpolation][ruby-for-beginners.rubymonstas.org-interpolation] while double-quoted does both.
Expand Down
2 changes: 2 additions & 0 deletions concepts/strings/introduction.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Introduction

A `String` in Ruby is an object that holds and manipulates an arbitrary sequence of bytes, typically representing characters. Strings are manipulated by calling the string's methods.
2 changes: 1 addition & 1 deletion docs/24pullrequests.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 24 Pull Requests for Exercism - Ruby Edition!
# 24 Pull Requests for Exercism - Ruby Edition!

We are welcoming contributors to the project.

Expand Down
2 changes: 2 additions & 0 deletions docs/ABOUT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# About

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity.
It has an elegant syntax that is natural to read and easy to write.

Expand Down
2 changes: 1 addition & 1 deletion docs/INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Installation
# Installation

Choose your installation method at the [Ruby installation page](https://www.ruby-lang.org/en/documentation/installation/) for instructions on installing Ruby.

Expand Down
2 changes: 1 addition & 1 deletion docs/LEARNING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Recommended Learning Resources
# Recommended Learning Resources

Exercism provides exercises and feedback but can be difficult to jump into for those learning Ruby for the first time. These resources can help you get started:

Expand Down
6 changes: 3 additions & 3 deletions docs/RESOURCES.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Recommended Resources
# Recommended Resources

### Environment
## Environment
* [Ruby](https://www.ruby-lang.org/)
* [Ruby Gems](https://rubygems.org/)
* [Bundler](http://bundler.io/)
* [RVM](https://rvm.io/)
* [rbenv](https://github.com/rbenv/rbenv)

### Docs
## Docs
* [Ruby Doc](http://ruby-doc.org/)
* [API Dock](http://apidock.com/)
* [Minitest](http://docs.seattlerb.org/minitest/)
2 changes: 2 additions & 0 deletions docs/TESTS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Tests

## Running Tests

Execute the tests with:
Expand Down
2 changes: 2 additions & 0 deletions exercises/concept/amusement-park-improvements/.docs/hints.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Hints

## General

Review:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Instructions

Continuing your work with the amusement park, you are tasked with writing some utility methods to facilitate checking an attendee can use a ride.

## 1. Check if an attendee has a ride pass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

## True and False

True and false logical states are represented with `true` and `false` in Ruby. These may either be used as literals on their own, or as a result of logical or comparison methods.
Expand Down
2 changes: 2 additions & 0 deletions exercises/concept/amusement-park-improvements/.meta/design.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Design

## Goal

The goal of this exercise is to teach the student the basics of the Concept of "nil" in Ruby.
Expand Down
2 changes: 2 additions & 0 deletions exercises/concept/amusement-park/.docs/hints.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Hints

## General

About initializing object instances:
Expand Down
2 changes: 2 additions & 0 deletions exercises/concept/amusement-park/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Instructions

Working with an amusement park, you've been handed a specification to design a system to administer attendance and rides. You've been tasked with modeling the Attendee (person visiting the park).

## 1. Make new attendees
Expand Down
2 changes: 2 additions & 0 deletions exercises/concept/amusement-park/.docs/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

## Instance Variables

Objects can hold their own state by setting _instance variables_, which are created by prefixing `@` to a variable name.
Expand Down
2 changes: 2 additions & 0 deletions exercises/concept/amusement-park/.meta/design.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Design

## Goal

The goal of this exercise is to teach the student the basics of the concept instance variables and "nil" in Ruby.
Expand Down
2 changes: 2 additions & 0 deletions exercises/concept/assembly-line/.docs/hints.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Hints

## General

## 1. Calculate the production rate per second
Expand Down
2 changes: 2 additions & 0 deletions exercises/concept/assembly-line/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Instructions

In this exercise you'll be writing code to analyze the production of an assembly line in a car factory. The assembly line's speed can range from `0` (off) to `10` (maximum).

At its slowest speed (`1`), `221` cars are produced each hour. The production increases linearly with the speed. So with the speed set to `4`, it should produce `4 * 221 = 884` cars per hour. However, higher speeds increase the likelihood that faulty cars are produced, which then have to be discarded. The following table shows how speed influences the success rate:
Expand Down
2 changes: 2 additions & 0 deletions exercises/concept/assembly-line/.docs/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Introduction

## Numbers

## Conditionals
Expand Down
2 changes: 2 additions & 0 deletions exercises/concept/assembly-line/.meta/design.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Design

## Goal

The goal of this exercise is to teach the student how the concept of numbers is implemented in Ruby. It will introduce this concept through the two most common numeric types in Ruby: [`Integer`][integer-ruby] (whole number) and [`Float`][float-ruby] (floating-point number).
Expand Down
14 changes: 8 additions & 6 deletions exercises/concept/bird-count/.docs/hints.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
### General
# Hints

## General

- The bird count per day is stored in a [instance variable][instace-variable] named `birds_per_day`.
- The bird count per day is an array that contains exactly 7 integers.

### 1. Check what the counts were last week
## 1. Check what the counts were last week

- As this method does _not_ depend on the current week's count, it is defined as a [`class` method][class-method].
- There are [several ways to define an array][array-definition].

### 2. Check how many birds visited yesterday
## 2. Check how many birds visited yesterday

- Remember that the counts are ordered by day from oldest to most recent, with the last element representing today.
- Accessing the second last element can be done either by using its (fixed) index (remember to start counting from zero) or by calculating its index using the [array's size][array-length].

### 3. Calculate the total number of visiting birds
## 3. Calculate the total number of visiting birds

- It's possible to calculate the sum of a collection using the [Array#sum][array-sum] method.

### 4. Calculate the number of busy days
## 4. Calculate the number of busy days

- Ruby also provides a method for [counting elements on a collection][array-count]

### 5. Check if there was a day with no visiting birds
## 5. Check if there was a day with no visiting birds

- There are some methods that can be use to check the existence on an element on a colection. For example [Enumerable#any?][enumerable-any] and [Enumerable#all?][enumerable-all]

Expand Down
Loading