ruby

Ruby, map with index

There's always a tiny doubt about how to "map with index" when using Ruby. Let's see how, and we're also going back to basics of Ruby map in this article.

Posted January 20, 2022 - tagged ruby  ‐  6 min read

Ruby strftime, short and long story

"strftime" stands for "string from time". Which means "please Ruby format the time into a human-friendly format". Let's see how.

Posted January 13, 2022 - tagged ruby  ‐  9 min read

Ruby Enumerator : the what, the why, the how

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  ‐  7 min read

Ruby : The 'unless' keyword

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

How to write a switch statement in Ruby

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

Ruby private method : a hack

A tiny hack about how to declare and use private method in Ruby.

Posted April 13, 2021 - tagged ruby  ‐  4 min read

Check emptiness in Ruby : nil? vs blank? vs empty? vs presence?

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