Decorator pattern, the Ruby way

Hey! Did you ever want to add some functionality to an already existing method, but you feel that monkey patching or inheritance are not probably the best way to do it? In today’s post I will show you how you can achieve that in an elegant way. Did you guess it? Today we are going […]

3 things you must know about Ruby’s bang methods (!)

In this week’s post I am going to talk you about a topic that was asked in my YouTube channel, which is how to use bang methods in Ruby, those we write with a trailing exclamation mark (!). Stay with me if you want to become an expert on this field. Let’s go! 1. It […]

My thoughts: How should service objects in Rails ideally look like?

Hi everybody! What a hiatus, right? If you are asking yourself, what happened to you Alberto? The reality is that for a long time I wanted to included YouTube videos in my post and I promised myself that the next post I published would have a video for sure… what I did not anticipate is […]

Ruby: Hook methods: the inherited hook

As last week I went to Barcelona and didn’t have enough time in the weekend to properly prepare a larger topic, this week’s post will be short and concise. As a novelty, I will also layout this post in a sort of a record card that may be reused for other hook methods or even patterns in […]

Ruby: Methods defined in Rake tasks

Last week during a code review at work, this thing became a topic again. This time I’ve decided to write a post about it so other colleagues can learn from it and be aware of the potential risks it implies to define methods in your rake files. The next time I need to refer to […]

Ruby: Range#include? vs Range#cover?

When it comes to check if an item is included in a Range, most Ruby programmers tend to use the include? method only. Probably this is because the include? method comes with the Enumerable module and therefore we are used to have it available in several classes. But the Range class comes with a less […]

Print Ruby objects internal state: puts vs p

Today I decided to make a short post about how to print an object’s internal state. puts Usually when we want to print out something in Ruby, the first method that comes to our mind is puts. The method puts prints all the arguments we pass in to it and inserts a new line after each […]

How to tell a good test story with RSpec

The problem Are you having trouble understanding your test suites? Do you find yourself scrolling up and down over a spec file to find where that method comes from? Are your specs difficult to read? If you use RSpec in your daily job I am pretty sure this will sound familiar to you. RSpec is […]

First impressions about Ruby

Since a few months I started to have interest on the Ruby programming language. As I am an agile enthusiast, I also wanted to give a try to a language that focus itself on coding and not on superfluous keywords or programming conventions, to a web framework (RoR, more of this on later posts) that […]