How to Use Ruby Time & Date Classes

Time is a class in Ruby that helps you represent a specific point in time. After reading this article you’ll learn everything you need to know to become a Ruby time wizard! Topics covered: How to convert strings into time objects How to break down a time into components (day/hours/milliseconds…) How to use the Date, … Read more

Ruby Refactoring Techniques: An Introduction

If you aren’t familiar with the term, refactoring is the act of improving the quality of code without changing what it does. This will make your code a lot easier to work with. In this post you will learn some common Ruby refactoring techniques Let’s get started! Extract Method One of the most common refactorings … Read more

The Many Uses Of Ruby Case Statements

Whenever you need to use some if / elsif statements you could consider using a Ruby case statement instead. In this post, you will learn a few different use cases and how it all really works under the hood. Note: In other programming languages this is known as a switch statement. The components of a … Read more

Ruby NLP: N-gram Analysis For Fun & Profit

What would you do if you are given a big collection of text & you want to extract some meaning out of it? A good start is to break up your text into n-grams. Here’s a description: In the fields of computational linguistics and probability, an n-gram is a contiguous sequence of n items from … Read more

How to Use Recursion & Memoization in Ruby

What is recursion in Ruby? Recursive functions are those that keep calling themselves until they hit an end goal (also known as the base case). After each function call you make progress towards this base case, reducing the amount of work left to be done. Once the base case is reached, the recursion ends, and … Read more