Tag Archives: ruby

Going beyond typing cap deploy

I mentioned earlier that if you don't use Capistrano too much, you might not be aware it's designed in such a way that it can be called happily from within Ruby code as well as being called on the command line. In fact, the snippets below from the rdoc pages for the project, given idea [...]
Posted in Coding | Also tagged , , | Leave a comment

Making arrays with ruby, without those pesky commas

The most common way to create an array in Ruby is do this: my_shiny_new_array = ["tom", "dick", "harry", "jonah", "percy", "jermaine"] Thanks to its perly origins though, you also have a more idiomatic way to do this in Ruby, like so: %w(tom dick harry jonah percy jermaine) Because Ruby has such a flexible syntax, it's [...]
Posted in Journal | Also tagged , | 2 Comments

Poking around the Capistrano gem binary,

I've recently been trying to get an understanding of how Rubygems lets us 'require' external code libraries by looking at a typical gem binary, because wasn't too clear to me how everything worked under the hood, and when I've tried to modify existing gems, I've been left scratching my head, generally unable to progress beyond [...]
Posted in Coding, Journal | Also tagged , | 1 Comment

Frustrating and Cryptic Ruby Idioms (#1 of a series)

I keep coming across these FACRI's (Frustrating and Cryptic Ruby Idioms) in my work, so I'm jotting them here in the hope that I'll remember them better in future. Ruby idioms Ruby is a wonderful, if somewhat slow and memory hungry language, with an incredibly flexible and expressive syntax. However this flexibility leads to the [...]
Posted in Journal | Also tagged , , | 1 Comment

Renaming stuff with Ruby

I've been mucking around on the command line with Ruby again of late, and one thing that tripped me up initially, but is now firmly on my list of things I Like About Programming is how Ruby handles loops. With javascript, actionscript, php, it's pretty common to iterate through an array with a for loop [...]
Posted in Journal | Also tagged , | 2 Comments