Announcing the colorizable gem

We were working on a project recently where we needed to store colors and convert those colors to different formats (we build custom iPhone apps for studios that use Tula Software). Rather than jump right in and write our own code for this, we looked around a found a great gem called color.

We were further inspired by one of my favorite gems, money-rails, which allows you to simply mark an attribute as "money" and it does all the work for you (formatting, currency, converting to dollars if stored as cents).

We threw together a similar gem called colorizable. Colorizable gives you all the power of the color gem, turned on with a simple "colorize" statement.

class Uniform < ActiveRecord::Base
colorize :primary_color, :secondary_color
end
uniform = Uniform.new
uniform.primary_color = "#cccccc"
uniform.primary_color.red # 204
uniform.primary_color.green # 204
uniform.secondary_color = { r: 204, g: 204, b: 204 }
uniform.secondary_color.to_s # #cccccc
view raw colorizable.rb hosted with ❤ by GitHub

Is this thing on?

One of the things I've noticed is that once you're on a roll with writing it's much easier to keep it going. Likewise, take an extended hiatus and next thing you know it's been 6 months since your last post.

I've been writing very regularly on the Tula blog, but haven't been writing here as much as I'd like. Time to change that, so here's a post to unclog the tubes.

More better to follow soon.