Date: Mon, 8 Jul 2024 11:45:47 +0000
Subject: [PATCH 4/7] Correct grammar and Improve clarity (#28144)
---
.../introduction/motivation_and_mindset.md | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/foundations/introduction/motivation_and_mindset.md b/foundations/introduction/motivation_and_mindset.md
index 9e1e2269550..47dc691bf84 100644
--- a/foundations/introduction/motivation_and_mindset.md
+++ b/foundations/introduction/motivation_and_mindset.md
@@ -2,7 +2,7 @@
Learning to code is incredibly rewarding but can also be difficult and frustrating. Like any skill worth knowing, it takes time to acquire, and it can't be learned in a weekend or even a month. With that said, we believe anyone can learn how to program as long as they are willing to put in the time and effort.
-So before we get into the meat of the curriculum, we're going to go over the following to help you get the most out of The Odin Project: the things that will help you succeed in your goal of learning to code and the pitfalls that you should try to avoid.
+So before we get into the meat of the curriculum, we'll cover the following aspects to help you get the most out of The Odin Project: factors that will help you succeed in learning to code and the pitfalls that you should try to avoid.
### Motivation
@@ -54,7 +54,7 @@ You will inevitably get stuck at some point in the curriculum, perhaps due to a
- Take a break: Allow your diffuse learning state to work on the problem.
- Ask for help in the [TOP Discord server](https://discord.gg/theodinproject); come prepared with your research. People will be more willing to help you when they can see you have already put effort into trying to figure out the solution on your own.
-Additionally, feel free to follow the diagram below that should help you going through problems that you may come across:
+Additionally, feel free to follow the diagram below to help you navigate problems that you may come across:
![diagram to help learners go through problems when they are stuck](https://cdn.statically.io/gh/TheOdinProject/curriculum/978ba0e91a6a47452de819246f4c495e6b092f54/foundations/introduction/motivation_and_mindset/imgs/00.png)
@@ -64,13 +64,13 @@ As technology advances, we have seen some incredible tools emerge that can help
While these tools are amazing, learners should be aware of the impacts that using such tools can have on core competency. David Humphrey, a computer science professor, [wrote about ChatGPT and its potentially negative impacts on core learning.](https://blog.humphd.org/cheatgpt/) It is a good read about the pitfalls of using generative AI in an educational context.
-For learners that are new to programming, tools like ChatGPT or Github Copilot can result in some blindspots and gaps in your knowledge.
+For learners who are new to programming, tools like ChatGPT or GitHub Copilot can result in blindspots and gaps in your knowledge.
1. By using a generative AI, learners may miss the opportunity to discover how something works and why things are done that way.
-1. Asking good questions is an important skill to have, and using generative AI to skip asking people (like our helpful Discord community) means that your development of this skill is delayed.
+1. Asking good questions is an important skill, and relying on generative AI instead of asking people (like our helpful Discord community) can delay the development of this skill.
1. Learning to talk about the code that one writes is another important skill. In a professional environment, it is highly likely that you will be doing code reviews where you have to explain the how and why behind what you are presenting. Using the Odin community to ask good questions about your code when you require help can help develop this skill as well.
1. As David Humphrey mentions, the output of generative AI must be closely scrutinized, and learners who are new to programming generally don't have a good overall understanding to be able to determine if the output is good or bad.
-1. While learning how to provide good prompts to an AI tool is a skill, it is one that is supplementary to developing foundational programming skills. The Odin curriculum strives to teach that foundational skill.
+1. While learning how to provide good prompts to an AI tool is a skill, it is supplementary to developing foundational programming skills. The Odin curriculum strives to teach that foundational skill.
1. AI tools are designed to answer questions and are not designed to help learners develop research and problem solving skills. If you ask an AI for information, it will provide information to you. If you ask a human, they may invite you to share your understanding of the problem and offer some guidance on how to discover a solution.
1. Without practice in research, problem solving and critical thinking, interviews could be a struggle since it is very likely that applicants would not be allowed to use AI tools.
@@ -80,11 +80,11 @@ We do not recommend using AI tools for your learning.
You will have more success with Odin by putting **consistent** time into it rather than working on it once a week. Building a habit of studying every day at a specific time and with a specific goal will ensure that you make consistent progress.
-It may take you longer than others to grasp concepts, or it may take you less time. This doesn't mean you're smarter or dumber than others, it means you've had differing life experiences that may or may not have prepared you for learning this stuff. Someone who grew up around an engineer may have some advantages over someone who didn't, but it doesn't mean you can't learn those skills.
+It may take you longer than others to grasp concepts, or it may take you less time. This doesn't mean you're smarter or dumber than others, it means you've had differing life experiences that may or may not have prepared you for learning those concepts. Someone who grew up around an engineer may have some advantages over someone who didn't, but it doesn't mean you can't learn those skills.
-The Odin Project isn't like college or university, it is self paced and allows you to get a really solid grasp of concepts before moving on. In school, you're forced to keep up or you will fail. The difference here is that coming into The Odin Project, you're not expected to have much knowledge; there are no prerequisites. We've had people be successful coming through here who only knew how to check their email with a computer. We've also seen success from computer science degree holders. Treating The Odin Project like a static timeline is understandable, but is a sign of misplaced expectations. You don't know what you don't know yet, and that's OK! There are no due-dates on things in The Odin Project so you can spend the time to do it right and discuss the topics.
+The Odin Project isn't like college or university, it is self-paced and allows you to get a solid grasp of concepts before moving on. In school, you're forced to keep up, or you will fail. The difference with The Odin Project is that you’re not expected to have much prior knowledge; there are no prerequisites. We've had people be successful coming through here who only knew how to check their email with a computer. We've also seen success from computer science degree holders. Treating The Odin Project like a static timeline is understandable, but is a sign of misplaced expectations. You don't know what you don't know yet, and that's OK! There are no due-dates on lessons in The Odin Project, so you can spend enough time to do it right and discuss the topics.
-Deadlines cause un-needed stress. Since The Odin Project is a free and open platform, you are not beholden to a deadline. Creating your own deadlines is a good way to rush concepts that should not be rushed. This course is very research based, meaning you will have to do research to complete tasks and projects. There's no telling if you can find the article or post that helps you in the right way, quickly to meet your deadlines, but we bet you learned a TON along the way that you can use in the future. People that do this kind of research and strive to write better solutions tend to become better developers in the future. There's no knowing how long it could take you to learn how to query stuff to find your answers. There are no solid guidelines on that. If you're doing The Odin Project because you need a high paying job *right-now*, you're not going to become a solid developer within the timeframe you have set. Stress and anxiety absolutely do not help you learn either. Relax and just enjoy the ride.
+Deadlines cause unneeded stress. Since The Odin Project is a free and open platform, you are not beholden to a deadline. Creating your own deadlines can lead to rushing through concepts that should not be rushed. This course is very research based, meaning you will have to do research to complete tasks and projects. There’s no guarantee you will find the right article or post quickly enough to meet your deadlines, but you will likely learn a TON along the way that you can use in the future. People that do this kind of research and strive to write better solutions tend to become better developers in the future. There’s no way to know how long it will take you to learn how to query concepts to find your answers. There are no solid guidelines on that. If you're doing The Odin Project because you need a high-paying job *right now*, you’re unlikely to become a solid developer within the timeframe you have set. Stress and anxiety absolutely do not help you learn either. Relax and just enjoy the ride.
Long story short: Don't worry, just go learn!
@@ -131,13 +131,13 @@ Digital distractions are email and Facebook notifications and time-wasting websi
Physical distractions are distractions from your environment, like a TV in the background or other people talking. These distractions can be just as damaging to your focus as digital distractions.
-**Solution:** Find a quiet place to study where you can go to focus in your home. If that's not an option, you can use noise cancelling headphones to block out noisy distractions in your environment. There are also complimentary public and university libraries that are serene and comfortable. Some libraries even operate 24/7, uninterrupted. Beyond just providing a pleasant study space, the presence of others studying around you instills a sense of productivity.
+**Solution:** Find a quiet place in your home where you can focus on your studies. If that's not an option, you can use noise cancelling headphones to block out noisy distractions in your environment. There are also complimentary public and university libraries that are serene and comfortable. Some libraries even operate 24/7, uninterrupted. Beyond just providing a pleasant study space, the presence of others studying around you instills a sense of productivity.
#### Rabbit holes
Because we cover so much material on The Odin Project and link to so many high quality courses and tools, it is easy for students to get pulled into rabbit holes by spending time trying to learn all there is to know about a subject that they aren't ready for or won't benefit them much. **We have put a lot of effort into structuring the curriculum** so that all of the important things that you need to know about web development are covered exactly when you need to know them.
-**Solution:** Stick to the path laid out as much as possible. Try to limit time spent going down rabbit holes as these sidetracks can really ruin your momentum.
+**Solution:** Stick to the path laid out as much as possible. Try to limit time spent going down rabbit holes, as these sidetracks can really ruin your momentum.
#### Comparing yourself to others
@@ -145,7 +145,7 @@ Students often compare themselves to others who are farther along in their codin
**Solution:** Only compare yourself to your past self. Have your abilities and knowledge improved from where you were last week, last month, or last year? Be proud of the progress that you've made!
-#### Counter productive note-taking
+#### Counterproductive note-taking
The Odin Project does not recommend taking a lot of notes throughout your web development educational journey because it can be time-consuming and often leads to wasted effort.
@@ -153,7 +153,7 @@ The Odin Project does not recommend taking a lot of notes throughout your web de
### Conclusion
-Learning any new skill is a journey full of speed bumps and obstacles to be overcome. We hope that the principles laid out here will put you in a much better position to succeed and get the most out of The Odin Project.
+Learning any new skill is a journey full of speed bumps and obstacles to overcome. We hope that the principles laid out here will put you in a much better position to succeed and get the most out of The Odin Project.
### Assignment
From c3423cb3d32f14f3c8b4f28a63623c2b986f0f06 Mon Sep 17 00:00:00 2001
From: Nikita Revenco <154856872+nikitarevenco@users.noreply.github.com>
Date: Mon, 8 Jul 2024 17:51:13 +0100
Subject: [PATCH 5/7] Component Lifecycle Methods: Add link to canvas element
(#27554)
* Update component_lifecycle_methods.md
* Update component_lifecycle_methods.md
---
react/class_components/component_lifecycle_methods.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/react/class_components/component_lifecycle_methods.md b/react/class_components/component_lifecycle_methods.md
index f97497591cc..e9976e45e51 100644
--- a/react/class_components/component_lifecycle_methods.md
+++ b/react/class_components/component_lifecycle_methods.md
@@ -16,7 +16,7 @@ The render function is the most used lifecycle method, and one that you've come
### componentDidMount()
-This method is run after the component is mounted (inserted in the DOM tree). You should make any calls to fetch data that is needed for the component here. It is also a good place to do anything that is reliant on the component, such as drawing on a canvas element that you just rendered.
+This method is run after the component is mounted (inserted in the DOM tree). You should make any calls to fetch data that is needed for the component here. It is also a good place to do anything that is reliant on the component, such as fetching from an API.
### componentDidUpdate()
From 0199be6a9923e387d64ae8b185b1416917e76cfc Mon Sep 17 00:00:00 2001
From: Preslav Tsvetanov <119291608+Preslav977@users.noreply.github.com>
Date: Mon, 8 Jul 2024 20:40:01 +0300
Subject: [PATCH 6/7] Ruby: Improve accessibility of link text and fix markdown
linting errors (#28362)
* Added descriptive text to the links of the lessons and projects Bubble Sort, TicTacToe, OOP, and Files and Serialization.
* Added the required text between the knowledge check and list in the Files and Serialization and ran the following scripts to fix the lint errors.
* Fixed the linting errors, changed the lists to not be nested and amended the last sentence in additional resource in OOP Ruby path.
* Improved the grammar in OOP lesson Ruby.
---
.../project_bubble_sort.md | 2 +-
.../files_and_serialization.md | 26 +++++++++++--------
.../object_oriented_programming.md | 9 +++----
.../project_tic_tac_toe.md | 8 +++---
4 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/ruby/basic_ruby_projects/project_bubble_sort.md b/ruby/basic_ruby_projects/project_bubble_sort.md
index 9d1759eb067..1c1989f6d03 100644
--- a/ruby/basic_ruby_projects/project_bubble_sort.md
+++ b/ruby/basic_ruby_projects/project_bubble_sort.md
@@ -4,7 +4,7 @@ Sorting algorithms are some of the earliest that you typically get exposed to in
One of the simpler (but more processor-intensive) ways of sorting a group of items in an array is **bubble sort**, where each element is compared to the one next to it and they are swapped if the one on the left is larger than the one on the right. This continues until the array is eventually sorted.
-Check out [this video from Harvard's CS50x on Bubble Sort](https://www.youtube.com/watch?v=8Kp-8OGwphY).
+Check out this [video from Harvard’s CS50 on Bubble Sort](https://www.youtube.com/watch?v=8Kp-8OGwphY).
There's also [an entry on Bubble Sort on Wikipedia](http://en.wikipedia.org/wiki/Bubble_sort) that's worth taking a look at.
diff --git a/ruby/files_and_serialization/files_and_serialization.md b/ruby/files_and_serialization/files_and_serialization.md
index c6ee0193058..2d3bb270ca4 100644
--- a/ruby/files_and_serialization/files_and_serialization.md
+++ b/ruby/files_and_serialization/files_and_serialization.md
@@ -25,26 +25,30 @@ This section contains a general overview of topics that you will learn in this l
### Assignment
+
1. Read [Thoughtbot's I/O in Ruby](https://thoughtbot.com/blog/io-in-ruby). You can ignore both the 'Putting it all together' and the 'Working with disparate APIs' sections.
- 2. Watch [icc0612's introduction to serialization](https://www.youtube.com/watch?v=uS37TujnLRw). It will explain the concept of serialization before you implement it in Ruby.
- 3. Read [Choosing the Right Serialization Format](https://www.sitepoint.com/choosing-right-serialization-format/) for more information about the various serialization options you can choose from.
- 4. Skim [Alan Skorkin's](http://www.skorks.com/2010/04/serializing-and-deserializing-objects-with-ruby/) post about serialization. Some of the code examples are outdated, but this post still contains relevant information. If you want to follow along with the code examples, copy and paste them into your code editor and use word wrap.
- 5. Read the sections 'Ruby files' and 'Ruby directories' from the [Input/Output chapter of Zetcode's Ruby Tutorial](http://zetcode.com/lang/rubytutorial/io/) for examples of how to manipulate files and directories using the `File` and `Dir` classes.
+ 1. Watch [icc0612's introduction to serialization](https://www.youtube.com/watch?v=uS37TujnLRw). It will explain the concept of serialization before you implement it in Ruby.
+ 1. Read [Choosing the Right Serialization Format](https://www.sitepoint.com/choosing-right-serialization-format/) for more information about the various serialization options you can choose from.
+ 1. Skim [Alan Skorkin’s article about object serialization in Ruby](http://www.skorks.com/2010/04/serializing-and-deserializing-objects-with-ruby/). Some of the code examples are outdated, but this post still contains relevant information. If you want to follow along with the code examples, copy and paste them into your code editor and use word wrap.
+ 1. Read the sections 'Ruby files' and 'Ruby directories' from the [Input/Output chapter of Zetcode's Ruby Tutorial](http://zetcode.com/lang/rubytutorial/io/) for examples of how to manipulate files and directories using the `File` and `Dir` classes.
+
### Knowledge check
- * [How would you go through the lines of a file using an `IO` object?](https://thoughtbot.com/blog/io-in-ruby)
- * [How would you take the Array `[1,2,3]` and serialize it into a JSON string format?](https://www.sitepoint.com/choosing-right-serialization-format/)
- * [What are the benefits of YAML vs JSON vs MessagePack serialization formats?](https://www.sitepoint.com/choosing-right-serialization-format/)
- * [How can you check if a file or directory exists?](http://zetcode.com/lang/rubytutorial/io/)
- * [How can you list a directory's contents in the form of an array?](http://zetcode.com/lang/rubytutorial/io/)
+The following questions are an opportunity to reflect on key topics in this lesson. If you can't answer a question, click on it to review the material, but keep in mind you are not expected to memorize or master this knowledge.
+
+- [How would you go through the lines of a file using an `IO` object?](https://thoughtbot.com/blog/io-in-ruby)
+- [How would you take the Array `[1,2,3]` and serialize it into a JSON string format?](https://www.sitepoint.com/choosing-right-serialization-format/)
+- [What are the benefits of YAML vs JSON vs MessagePack serialization formats?](https://www.sitepoint.com/choosing-right-serialization-format/)
+- [How can you check if a file or directory exists?](http://zetcode.com/lang/rubytutorial/io/)
+- [How can you list a directory's contents in the form of an array?](http://zetcode.com/lang/rubytutorial/io/)
### Additional resources
This section contains helpful links to related content. It isn't required, so consider it supplemental.
-- [Everything You Need to know about Serialization in Ruby on Rails](https://blog.kiprosh.com/serialization_in_ruby_on_rails_part_one/)
+- [Everything You Need to know about Serialization in Ruby on Rails](https://blog.kiprosh.com/serialization_in_ruby_on_rails_part_one/)
- [Ruby Monk's section on Serializing](https://web.archive.org/web/20160505174806/http://rubymonk.com/learning/books/4-ruby-primer-ascent/chapters/45-more-classes/lessons/104-serializing)
- [Short Example of Serialization](https://web.archive.org/web/20200627063721/http://rubylearning.com/satishtalim/object_serialization.html) from Ruby Learning
-- How to [Read](https://www.youtube.com/watch?v=92li0A8d4io) and [Write](https://www.youtube.com/watch?v=FW9hDsMY1is) Files by Giraffe Academy
\ No newline at end of file
+- How to [Read](https://www.youtube.com/watch?v=92li0A8d4io) and [Write](https://www.youtube.com/watch?v=FW9hDsMY1is) Files by Giraffe Academy
diff --git a/ruby/object_oriented_programming_basics/object_oriented_programming.md b/ruby/object_oriented_programming_basics/object_oriented_programming.md
index 6c3181fd3d3..bcb4036512d 100644
--- a/ruby/object_oriented_programming_basics/object_oriented_programming.md
+++ b/ruby/object_oriented_programming_basics/object_oriented_programming.md
@@ -6,7 +6,7 @@ The concepts you'll learn here are often less specific to Ruby itself and more w
There are two projects in this Object Oriented Programming Basics section, but this does not mean that you will only use OOP for these two projects. Ruby is a object-oriented language, so it is important to use OOP for all of the remaining projects.
-There is a lot of reading in this lesson, so you are encouraged to code along with each example. If you find an example that does not make sense, ask for help in the `#ruby-help` channel in our [Discord](https://discord.gg/fbFCkYabZB) server. To get the most out of each example, try to apply what you learned by adding similar functionality on your own.
+There is a lot of reading in this lesson, so you are encouraged to code along with each example. If you find an example that does not make sense, ask for help in the `#ruby-help` channel in [our Discord server](https://discord.gg/fbFCkYabZB). To get the most out of each example, try to apply what you learned by adding similar functionality on your own.
### Lesson overview
@@ -26,7 +26,7 @@ This section contains a general overview of topics that you will learn in this l
- [Ruby Explained: Inheritance and Scope](http://www.eriktrautman.com/posts/ruby-explained-inheritance-and-scope)
1. Read the article [Object Relationships in Basic Ruby](https://medium.com/@marcellamaki/object-relationships-in-basic-ruby-1af5773fff48) to see an example of how two classes can interact.
1. Read the [Bastard's Chapter on Error Handling](http://ruby.bastardsbook.com/chapters/exception-handling/) to reinforce your understanding of dealing with errors.
-1. Do [Quiz #5](http://www.codequizzes.com/ruby/beginner/intro-object-oriented-programming) and [Quiz #7](http://www.codequizzes.com/ruby/beginner/modules-classes-inheritance) from Code Quizzes
+1. Do this [quiz on introductory object-oriented programming](http://www.codequizzes.com/ruby/beginner/intro-object-oriented-programming) and this [quiz on modules, classes, and inheritance](http://www.codequizzes.com/ruby/beginner/modules-classes-inheritance) from Code Quizzes.
@@ -48,6 +48,5 @@ This section contains helpful links to related content. It isn't required, so co
- [Kevin Berridge's video presentation](http://vimeo.com/91672848) covers major themes of practical object-oriented design, with many references to Sandi Metz's book, in about 40 minutes.
- If you want more examples to code along with, check out [Zetcode's OOP section](http://zetcode.com/lang/rubytutorial/oop/) and [Zetcode's second OOP section](https://zetcode.com/lang/rubytutorial/oop2/) until they start talking about exceptions (~80% of the way down).
-- After you have completed several OOP projects, the following books by Sandi Metz are essential to build on the foundational concepts in this lesson.
- - [99 Bottles of OOP](https://sandimetz.com/99bottles) is a hands-on workbook that you should code along with to get the most out of it. This is a great resource if you feel uncertain about OOP concepts and would like to guided through refactoring examples and explanations.
- - [Practical Object-Oriented Design in Ruby](https://www.poodr.com/) is a traditional technical book with practical examples. This is a great resource after 99 Bottles or if you already feel like you fully understand OOP concepts.
+- [99 Bottles of OOP](https://sandimetz.com/99bottles) is a hands-on workbook that you should code along with to get the most out of it. This is a great resource if, after completing several OOP projects, you still feel uncertain about OOP concepts and would like to be guided through some refactoring examples and explanations.
+- [Practical Object-Oriented Design in Ruby](https://www.poodr.com/) is a traditional technical book with practical examples. This is a great resource if, after completing several OOP projects, you still feel uncertain about OOP concepts and would like to be guided through some refactoring examples and explanations.
diff --git a/ruby/object_oriented_programming_basics/project_tic_tac_toe.md b/ruby/object_oriented_programming_basics/project_tic_tac_toe.md
index 6d6f2b7066e..24aa1f16bd6 100644
--- a/ruby/object_oriented_programming_basics/project_tic_tac_toe.md
+++ b/ruby/object_oriented_programming_basics/project_tic_tac_toe.md
@@ -1,15 +1,17 @@
### Introduction
-Remember Tic Tac Toe? See [Wikipedia](http://en.wikipedia.org/wiki/Tic-tac-toe) if you can't remember the rules, or if you haven't ever played. It involves a couple of players, a board, checking for victory in a game loop... all the conditions that make it a fun little problem to solve using our newfound OOP sea legs. Let's build it!
+Remember [Tic Tac Toe](https://en.wikipedia.org/wiki/Tic-tac-toe) (also known as "Noughts and Crosses")? It involves a couple of players, a board, checking for victory in a game loop... all the conditions that make it a fun little problem to solve using our newfound OOP sea legs. Let's build it!
### Assignment
Build a tic-tac-toe game on the command line where two human players can play against each other and the board is displayed in between turns.
+
1. Think about how you would set up the different elements within the game... What should be a class? Instance variable? Method? A few minutes of thought can save you from wasting an hour of coding.
- 2. Build your game, taking care to not share information between classes any more than you have to.
- 3. Post your solution below, then check out [this example solution from RosettaCode.org](http://rosettacode.org/wiki/Tic-tac-toe#Ruby).
+ 1. Build your game, taking care to not share information between classes any more than you have to.
+ 1. Post your solution below, then check out this [example Tic Tac Toe solution from RosettaCode.org](http://rosettacode.org/wiki/Tic-tac-toe#Ruby).
+
### Additional resources
From fa1cf4d262b937959f91f178f07ceb1daae32b02 Mon Sep 17 00:00:00 2001
From: Lakshya Tyagi <138753214+LAKSHYA201@users.noreply.github.com>
Date: Tue, 9 Jul 2024 00:33:23 +0530
Subject: [PATCH 7/7] Advanced Ruby: Improve link text accessibility and fix
lint errors (#28363)
* docs:change assignment link text in pattern_matching.md
* docs: made changes to blocks.md in advanced ruby
* docs: made changes in link text in project_custom_enumerables.md
* fix: fixed some linting errors in blocks.md and pattern_matching.md
---
ruby/advanced_ruby/blocks.md | 14 ++--
ruby/advanced_ruby/pattern_matching.md | 65 ++++++++++---------
.../project_custom_enumerables.md | 2 +-
3 files changed, 43 insertions(+), 38 deletions(-)
diff --git a/ruby/advanced_ruby/blocks.md b/ruby/advanced_ruby/blocks.md
index 499da59ccad..9487f0eade1 100644
--- a/ruby/advanced_ruby/blocks.md
+++ b/ruby/advanced_ruby/blocks.md
@@ -332,7 +332,7 @@ nested_array.select {|a, b| a + b > 10 }
As you can see, `#select` has two arguments specified `|a, b|`, on each iteration we pass a single element of nested_array into the block. On the first iteration this is: `[1, 2]`, this array now, is deconstructed automatically (into a = 1, b = 2) and its values compared as specified. So on to the next rounds of iteration in which we pass `[3, 4]` and `[5, 6]` one by one.
This happens because the block `{|a, b| if a + b > 10 }` is treated as a non-lambda proc.
This property is not limited to `#select` but also applies to other `enum` methods like `#map`, `#each` etc.
-You can read more about this here: [documentation](https://docs.ruby-lang.org/en/3.3/Proc.html)
+You can read more about this in the [Proc class documentation](https://docs.ruby-lang.org/en/3.3/Proc.html).
A lambda, on the other hand, DOES care and will raise an error if you don't honor the number of parameters expected.
@@ -452,9 +452,9 @@ arr.map(&:to_i)
# => [1, 2, 3]
```
-What happens under the hood is that `#to_proc` is called on the symbol `:to_i`. You can see what it does in the [ruby docs](https://docs.ruby-lang.org/en/3.3/Symbol.html#method-i-to_proc). It returns a proc object which responds to the given method indicated by the symbol. So here, `#map` yields each value in the array to the proc object, which calls `#to_i` on it.
+What happens under the hood is that `#to_proc` is called on the symbol `:to_i`. You can see [what #to_proc does](https://docs.ruby-lang.org/en/3.3/Symbol.html#method-i-to_proc) in the Ruby docs. It returns a proc object which responds to the given method indicated by the symbol. So here, `#map` yields each value in the array to the proc object, which calls `#to_i` on it.
-(Yes, names of methods like `#to_i` can be passed around using symbols. It's outside the scope of this lesson, but check out the [documentation](https://docs.ruby-lang.org/en/3.3/Object.html#method-i-send) for `#send` if you're interested. And this Stack Overflow [article](https://stackoverflow.com/questions/14881125/what-does-to-proc-method-mean) on how `#send` and `#to_i` are used together for `arr.map(&:to_i)` to work.)
+(Yes, names of methods like `#to_i` can be passed around using symbols. It's outside the scope of this lesson, but check out the [documentation for #send](https://docs.ruby-lang.org/en/3.3/Object.html#method-i-send) if you're interested, and this Stack Overflow article on [how #send and #to_i are used together](https://stackoverflow.com/questions/14881125/what-does-to-proc-method-mean) for `arr.map(&:to_i)` to work.)
The `&` also works the other way. You can prepend it to a proc object and it converts it to a block, and passes the block to the method being called.
@@ -492,15 +492,17 @@ Blocks are used everywhere in Ruby. You'll find many use cases, and see them use
After coming to grips with the information in this lesson you'll be a block, proc and lambda master, able to easily craft beautiful Ruby code.
### Assignment
+
-1. [This article](https://www.rubyguides.com/2016/02/ruby-procs-and-lambdas/) provides quite a nice summary of much of what we've covered here.
-2. Read [this article](https://www.honeybadger.io/blog/using-lambdas-in-ruby/) which also covers much of what we've used here. We really liked the small section on using lambdas as computed hashes and arrays. A cool use case.
+1. This article provides quite a nice [summary of blocks, procs and lambdas](https://www.rubyguides.com/2016/02/ruby-procs-and-lambdas/).
+1. Read this [article on lambdas in Ruby](https://www.honeybadger.io/blog/using-lambdas-in-ruby/) which also covers much of what we’ve used here. We really liked the small section on using lambdas as computed hashes and arrays. A cool use case.
+
### Knowledge check
-This section contains questions for you to check your understanding of this lesson. If you're having trouble answering the questions below on your own, review the material above to find the answer.
+The following questions are an opportunity to reflect on key topics in this lesson. If you can't answer a question, click on it to review the material, but keep in mind you are not expected to memorize or master this knowledge.
- [What is a block?](https://www.rubyguides.com/2016/02/ruby-procs-and-lambdas/#Understanding_Ruby_Blocks)
- [How is a block like a method?](https://www.rubyguides.com/2016/02/ruby-procs-and-lambdas/#Understanding_Ruby_Blocks)
diff --git a/ruby/advanced_ruby/pattern_matching.md b/ruby/advanced_ruby/pattern_matching.md
index 71adb84a847..14d2506dc97 100644
--- a/ruby/advanced_ruby/pattern_matching.md
+++ b/ruby/advanced_ruby/pattern_matching.md
@@ -76,18 +76,18 @@ The case/in format is best used when there are multiple conditionals you could p
There are multiple ways of potentially matching against an input. Patterns can be:
- - Any Ruby object which is matched using `===`. The Object Pattern.
- - A variable capture / Variable Pattern
- - An As Pattern
- - An Alternative Pattern
- - A Guard Condition
- - An Array Pattern
- - A Hash Pattern
+- Any Ruby object which is matched using `===`. The Object Pattern.
+- A variable capture / Variable Pattern
+- An As Pattern
+- An Alternative Pattern
+- A Guard Condition
+- An Array Pattern
+- A Hash Pattern
You can use the above patterns while also having the following experimental additions.
- - Rightward Assignment
- - A Find Pattern
+- Rightward Assignment
+- A Find Pattern
Patterns can also be matched using many of the patterns above together. For example, you may have an array inside a hash, so you could use the hash and array patterns. We'll go through each of the various patterns in more detail below.
@@ -95,7 +95,7 @@ When we say "pattern", we aren't talking about design patterns which you may hav
### Return values
-There are two possible outcomes for a pattern match statement - either there is a match or there is no match. If there is a match, it will return the last evaluated value in the body of the matching branch.
+There are two possible outcomes for a pattern match statement - either there is a match or there is no match. If there is a match, it will return the last evaluated value in the body of the matching branch.
If there are no matches, the pattern matching statement will return `NoMatchingPatternError`.
Consider the following example, where the variable `result` is assigned the value 3.
@@ -113,9 +113,9 @@ puts result
#=> 3
```
-When we `puts` something inside a case statement, we'll use `#=>` to show what `puts` will print.
-In your terminal, however, you'll see the value printed followed by `=> nil`, since `puts` returns `nil`.
-We'll omit that because it's not relevant to what we're trying to show you.
+When we `puts` something inside a case statement, we'll use `#=>` to show what `puts` will print.
+In your terminal, however, you'll see the value printed followed by `=> nil`, since `puts` returns `nil`.
+We'll omit that because it's not relevant to what we're trying to show you.
Just be aware that the `nil` you see is just the return value of `puts`. Standard Ruby behaviour.
As you'll see, though, the point of a pattern match usually is to not only match against a pattern, but also bind all or part of the match to one or more variables that you can then use outside of the pattern match expression.
@@ -143,16 +143,16 @@ It's important to note here that Ruby places the pattern to match on the left of
With Ruby pattern matching, you can match against the following literal types.
- - Booleans
- - nil
- - Numbers
- - Strings
- - Symbols
- - Arrays
- - Hashes
- - Ranges
- - Regular Expressions
- - Procs
+- Booleans
+- nil
+- Numbers
+- Strings
+- Symbols
+- Arrays
+- Hashes
+- Ranges
+- Regular Expressions
+- Procs
This isn't any different from what we can do with a case/when statement, but the power comes when you match these types within some of the other patterns as we'll see next.
@@ -666,22 +666,25 @@ With pattern matching, we do need to consider the case if there is no match. Wit
Pattern Matching provides a powerful way to get at the data you need in a way that makes sense. But as with any tool, you don't need to reach for it in every use case. For data structures that are shallow, just think about whether you need to bring in a pattern match when you could just grab the value using the hash and array methods already available. If you do find yourself deep in a nested structure with many checks for `nil` and a lot of edge case handling, it might be time to see if pattern matching brings something to the table.
### Assignment
+
-1. Read the [Ruby docs](https://docs.ruby-lang.org/en/3.3/syntax/pattern_matching_rdoc.html) on pattern matching. They cover quite a lot of ground.
+1. Read the [Ruby docs on pattern matching](https://docs.ruby-lang.org/en/3.3/syntax/pattern_matching_rdoc.html). They cover quite a lot of ground.
+
### Knowledge check
-This section contains questions for you to check your understanding of this lesson. If you're having trouble answering the questions below on your own, review the material above to find the answer.
-- What is pattern matching?
-- What is the difference between array patterns and hash patterns?
-- What is the variable pattern match?
-- What are the different ways of pattern matching on an array?
-- Explain the find pattern.
+The following questions are an opportunity to reflect on key topics in this lesson. If you can't answer a question, click on it to review the material, but keep in mind you are not expected to memorize or master this knowledge.
+
+- [What is pattern matching?](https://docs.ruby-lang.org/en/3.3/syntax/pattern_matching_rdoc.html)
+- [What is the difference between array patterns and hash patterns?](https://docs.ruby-lang.org/en/3.3/syntax/pattern_matching_rdoc.html#label-Patterns)
+- [What is the variable pattern match?](#variable-pattern)
+- [What are the different ways of pattern matching on an array?](#array-pattern-match)
+- [Explain the find pattern.](#find-pattern)
### Additional resources
-This section contains helpful links to related content. It isn’t required, so consider it supplemental.
+This section contains helpful links to related content. It isn't required, so consider it supplemental.
- [An Introduction to Pattern Matching in Ruby](https://blog.appsignal.com/2021/07/28/introduction-to-pattern-matching-in-ruby.html) from AppSignal should be another useful perspective on the material.
diff --git a/ruby/advanced_ruby/project_custom_enumerables.md b/ruby/advanced_ruby/project_custom_enumerables.md
index 452f19472aa..27d09bc68f0 100644
--- a/ruby/advanced_ruby/project_custom_enumerables.md
+++ b/ruby/advanced_ruby/project_custom_enumerables.md
@@ -42,7 +42,7 @@ If the block returns `true`/truthy for an element, we immediately `return` that
1. Fork and clone our [custom enumerables repo](https://github.com/TheOdinProject/custom_enumerable_project)
-1. Follow the [instructions in the README](https://github.com/TheOdinProject/custom_enumerable_project#installation) to get the repo setup locally
+1. Follow the [installation instructions in the README](https://github.com/TheOdinProject/custom_enumerable_project#installation) to get the repo setup locally.
1. Rebuild each of [the methods in the table at the end of the README](https://github.com/TheOdinProject/custom_enumerable_project#methods) and make sure they all pass the tests associated with them.