Ruby Journal

Liquid Template in Ruby Done Right

| Comments

Liquid Templating Engine is an awesome technology and with the power of gem ‘liquid’, everybody can start using without much hassles. I saw many projects used this gem but sadly most of them are quite bad. In this tutorial, I’ll go through a bad example and show you how to refactor it.

Genereate Gems Dependency Graph With Bundler

| Comments

One of the features I like about RubyMine is the gems dependency graph. This graps shows you all explicit/implicit dependencies of gems defined in your Gemfile. In this short tutorial, I’ll show how to generate this graph with Bundler.

Avoid Unless Syntax in a Chain of Conditions Statement

| Comments

Ruby gives us a nice human friendly unless which is equivalent to negation of if. Yet if we abuse using this method in a long complex statements, it could add more confusion for normal readers. In this article, I’ll give you one example to prove that you should not use unless in a chain of conditions statement.