How often does your program do exactly what you want the first time around? Many times our programs won’t work like you expect, so we have to use the art of debugging ruby to help us finding out why. You may be familiar with the following error message:

As you know, this means that […]

Read More

Using ruby threads you can make your applications do multiple things at the same time, making it faster. In MRI (Matz’s Ruby Interpreter) you will only benefit from threads in i/o bound applications. This limitation exists because of the GIL (Global Interpreter Lock), alternative Ruby interpreters like JRbuy or Rubinius can take full advantage of […]

Read More

Ruby regular expressions (regex for short) let us find specific patterns inside strings, with the intent of extracting that data for further processing. Two common use cases for regular expressions are validation and parsing. For example, think about an email address, with regular expressions we can define what a valid email address looks like. That […]

Read More

Sometimes you just want an object that can store some data for you, the struct class is very useful in that situation. Getting Started To create our Struct we pass in a series of symbols, which will become the instance variables of this class. They will have accessors defined by default (both for reading and […]

Read More

Data processing is a common task in programming. Data can come from many places: files, network, database, etc. In this post you will learn how to work with files and folders in Ruby. Reading files The file class allows you to open a file by simply passing in the file name to the open method: […]

Read More