Ruby

  1. Home
  2. Computing & Technology
  3. Ruby

Test Driven Development on Rails

If you've been using Test Driven Development with your Ruby code, it's time to put the tests to the Rails. Use TDD to write Web applications in Rails.

Test Drive Test Driven Development

Ruby Spotlight10

Amanda and Michael's Ruby Blog

This Week's New Releases

Friday July 3, 2009
  • win32-service 0.7.0

    Part of the win32utils project, win32-service allows you to create an manipulate Windows services from your Ruby program. This can be useful for both managing your Windows services from Ruby (for example, a monitoring program could restart a service if it stops responding), as well as making your Ruby (or other) programs into services.

  • Ruby Best Practices now in print

    Ruby Best Practices is a book unlike most other Ruby books. It doesn't teach new language features and isn't a reference manual. What Ruby Best Practices does is take real open source software and walk you through the source code. It will show you the best of what Ruby can do, and how to go about doing it. The book is available from O'Reilly and Amazon.

Sharpen Your Skills with RubyQuiz

Wednesday July 1, 2009

RubyQuiz is a game played on the Ruby mailing lists to test your programming ability. Each week, a new quiz is posted, presenting some interesting problem to be solved. These problems are usually hypothetical problems, but every now and then a practical problem pops up. Even if you can't complete the quizzes, reading other's solutions and the commentary alone can make you a better programmer.

This week's challenge is similar to a game of battleship. There's a shape in a 10x10 grid. You have to write a program that first finds this shape, then maps out the shape with the least number of queries into the 10x10 grid.

There are two sites for RubyQuiz. The old site archives all of the challenges up to #156. All newer challenges are on the new site, up to the current challenge #211.

Optional Method Parameters with Hashes

Monday June 29, 2009
Ruby provides a mechanism for optional method parameters. However, this mechanism is not very flexible. You cannot pass them by name, out of order, or omit some of the parameters. This article outlines how you can use hashes to emulate keyword or named parameters. This gets around these limitations with a little Ruby magic and just a little extra syntax.

This Week's New Releases

Friday June 26, 2009
  • RubyWeekend Programming Contest June 26-28

    This weekend is the RubyWeekend programming contest. The objective of this contest is to program a game in Ruby with the theme of "A Tiny World" and submit it within the time limits. Entries will then be judged and a winner announced.

    These type of game programming contests are quite popular in the PyGame scene, and now they've come to the Ruby programming scene. Ruby is the key here, so all entries must be coded in Ruby. You also might think that it's unrealistic to expect someone to program a game in 2 or 3 days. However, it's not quite that unrealistic. The games are rarely polished, and are more like tech demos or alphas of finished games. No one is expecting polish, just a functional game with a solid concept relating to "A Tiny World."

  • Flog 2.1.2

    Flog is a tool to tell you how tortured your code is. It's another of the emerging projects using Ruby parsing libraries to parse Ruby code. In a nutshell, Flog will give your code a score based on how much work is being done per line of code. Convoluted, compressed, busy and messy code will get higher scores. Clean code with simple statements on each line will get lower scores.

    There's also some debate whether lower scores are even good. Though scores that are too high may signify that your code is too Perl-like, reasonably high scores may not necessarily be a bad thing.

  • ImageScience 1.2.0

    ImageScience is a small library for resizing images. This is extremely useful for making thumbnail images in just about any web application that has attachments for image uploads. So what makes this so different than using RMagick?

    RMagic (and ImageMagick itself) is huge. It's a low-level C API wrapped up with Ruby. It does tons of things, including image resizing but also including drawing, composing, color correction, and many other types of image manipulation. It's notorious for memory leaks and is a lot more than you actually need if all you want to do is resize an image. ImageScience, on the other hand, is a very small native library for resizing images wrapped in a small Ruby wrapper. That's it. Simple, small, gets the job done.

Discuss

Community Forum

Explore Ruby

About.com Special Features

Ruby

  1. Home
  2. Computing & Technology
  3. Ruby

©2009 About.com, a part of The New York Times Company.

All rights reserved.