Last month I gave a talk at the local Macedonian Ruby User Group on how to build a Ruby Gem. It was a bit of history and then a practical guide on building a gem and an overview of what it involves to maintain it. You can find my slides from the presentation on speakerdeck.
In the talk I used my solution to the mars rover problem. It's a good example to demonstrate some best practices about project structure, naming conventions, coding principles and testing with Ruby. You can find the source code for it on github.