Ruby

Ruby is a very expressive programming language, whose design was influenced by some of the best bits of Perl, Smalltalk, Eiffel, Ada and Lisp. Ruby occupies a similar niche to Python – both languages are dynamically typed, support garbage collection and provide great libraries of re-usable code.

The Ruby community is very active, but you can easily keep up with what's going on at RubyFlow. You can also follow RubyFlow on Twitter.

Learning Ruby

If you're new to programming I'd recommend the Pragmatic Programmer's Learn to Program book.

If you've programmed before but are new to Ruby you could do worse things with your time than to read Why's Poignant Guide to Ruby (as technical books go it's not to everybody's taste, but it's hugely entertaining and very well written -- it might just get you hooked). More experienced programmers may find Programming Ruby and The Ruby Way by Hal Fulton more suitable.

Once you've got to grips with OO programming in Ruby, Dave Thomas's series of Ruby metaprogramming screencasts will give you an in depth understanding of how Ruby works (it'll even show you how to do prototypal inheritance, JavaScript or Io style).

Articles on Ruby

  1. Update your entire project to Ruby 1.9 hash syntax

    In version 1.9 Ruby introduced new syntax for hash literals whose keys are symbols. If you no longer need to support Ruby 1.8 it's worth updating your code, as the new syntax is more succinct. Doing it by hand would be painful, but with the Unix command line and a quick regular expression we can make the computer do the hard work.

    Continue reading

  2. Navigating your bundled gems in Vim

    Do you sometimes find yourself wanting to read the code of a method in one of the gems that your project is using? Wouldn't it be good if you could put your cursor on the method or class in question, and press a key to jump straight to the definition within the gem's source code? With the ctags program you can, and with the guard-ctags-bundler gem your tag files will be automatically updated when you add new gems to your bundle.

    Continue reading

    Published on in Ruby, Vim

  3. Patching "bundle open" to set your current directory

    Ruby programmers need to be able to read the source code of the libraries (gems) that they use. Bundler makes it easy to load the source of a gem into your editor, with the bundle open command, but it'd be useful if it changed your current directory before launching Vim.

    Continue reading

    Published on in Ruby, Vim

  4. Automating bundle exec

    Bundler is a great way to control the versions of the gems that are used in your Ruby application, but it requires you to run Ruby scripts and tools (such as rake and heroku) by prefixing them with an extra command (e.g. bundle exec rake). This is a pain, can be easy to forget, and can cause no end of subtle bugs if the script that you're running can be found outside of the bundled application, in your shell's PATH.

    Continue reading

  5. Ruby Manor

    Ruby Manor is one of those alternative conferences. It's not run for a profit. It doesn't cost a lot of money to attend (at £8 per head you pay just enough to cover the cost of the room and equipment), and the quality of the talks is consistently high. I wrote them all up.

    Read the talks

    Published on in Ruby

  6. Benchmarking Ruby exception handling

    Which is better, handling an exception or explicitly checking to see whether or not your code is going to break? The answer is "it depends". On the one hand exception handling allows us to write more legible code (often summed up by the saying "it's easier to ask forgiveness than permission"). On the other, handling an exception is often a costly operation; it can be faster to "look before you leap".

    How expensive is exception handling?

    Published on in Ruby

  7. Ruby Lightning Talks

    Tonight's LRUG meeting consisted of 8 quick 20x20 format presentations (20 slides, 20 seconds per slide) on a range of Ruby related topics. The speakers covered packaging gems for Debian, sending IM messages with XMPP, a quick intro to ruby-debug, RubyGame, smoke testing, Twitter bots and statistics in Ruby via the power of R.

    Read the talks

    Published on in Ruby

  8. Opening Ruby gems in TextMate

    How often do you find yourself wanting to check the source code of a locally installed Ruby gem? Do you find it painful digging around your filesystem to locate the gems directory? With mategem I just type mategem activerec[tab].

    Get mategem...