ruby

Articles about Ruby, the language

Ruby pattern matching

If you are not familiar with the pattern matching feature in Ruby, this article is a good recap of the basics and it also includes some useful tips for developers. What is pattern matching? If you are new to the feature, welcome to the typical “Pattern matching journey”; where first, you don’t know what it …

Ruby pattern matching Read More »

Ruby, the self keyword

In this article we will explore the self keyword of the Ruby language What is self in Ruby self is a reserved keyword in Ruby that always refers to the current object and classes are also objects, but the object self refers to frequently changes based on the situation or context. So if you’re in an instance, self refers to …

Ruby, the self keyword Read More »

Ruby block, procs and lambda

With the Ruby language, block, procs, and lambda are some different ways to use anonymous functions. Why the need for anonymous functions ? Ruby is a language that uses multiple programming paradigms, most commonly object-oriented and functional, and with its functional nature comes the idea of functions. Ruby uses three types of closures : blocks, procs, and …

Ruby block, procs and lambda Read More »

Ruby constants

How to define constants in Ruby, and how to use them – with one tricky part. Motivation We don’t have a lot of Ruby constants in the bootrAils starter. However, it’s always good to know how they work when the need arises.“Constants” are variables that are not meant to be changed. Let’s see how. In this article …

Ruby constants Read More »

Milliseconds in Ruby

How to get milliseconds in Ruby ? Let’s explore 3 scenarii. 1. Display time, down to milliseconds in Ruby If you want more info about strftime, please read this article : https://www.bootrails.com/blog/ruby-strftime-short-and-long-story/ – milliseconds, however, were not covered at this time 🙂 2. Get current time system in milliseconds First possibility is to use .strftime, again : Please note …

Milliseconds in Ruby Read More »

Scroll to Top