ruby

Articles about Ruby, the language

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

Posted March 30, 2021 – tagged ruby 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. “if” alone may not be enough if false or if nil won’t execute the corresponding condition, because false and nil are considered as falsy values. In other words, if …

Check emptiness in Ruby : nil? vs blank? vs empty? vs presence? Read More »

Ruby, map with index

tagged ruby 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. Intro Just like many other programming languages, the Map method is also in ruby. You use a ruby map or map, in general, to …

Ruby, map with index Read More »

Scroll to Top