Tag Archives: ruby
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 [...]
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 [...]
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 [...]
Going beyond typing cap deploy