In Ruby, object methods are public by default, while data is private. To access data, we use the accessor method.
Posted February 24, 2022 - tagged ruby
6 min read
If you're on the path to learning Ruby then you might have heard of this thing called an 'Enumerator'. As scary as it sounds, Enumerators are actually your friends and will be helping you a lot on your journey to becoming a Ruby *aficionado*. Since they are so important, let's quickly get you up and running within this lesson. We will be going over the what, the why, and the how of Enumeration.
Posted January 6, 2022 - tagged ruby
Last update : March 11, 2022 7 min read
You are probably familiar with the 'if else' control flow but there are certain situations where there may be a visually better way to write these statements. Here we will discuss how you can achieve this via the 'unless' keyword in Ruby and the different ways you can use it.
Posted June 18, 2021 - tagged ruby
3 min read
In Ruby, the classic 'switch statement' is possible with the *case/when* keywords. Whenever if statements become too long and start looking messy you might want to consider using the case statement to write cleaner code.
Posted April 27, 2021 - tagged ruby
4 min read
More often than not, you have to check if an object is empty or not, to avoid the famous *NullPointerException* - which is a *NoMethodError* in Ruby.
Posted March 30, 2021 - tagged ruby
7 min read