Archive for the ‘Ruby’ Category

Fixing rxml attribute escaping

Thursday, December 29th, 2005

The version of Builder used for rxml templates in Rails 1.0 doesn’t escape attribute values when they are written to the output. This means characters such as double quotes in the attribute values will cause invalid XML documents to be generated.

To avoid having to manually escape every attribute value in rxml templates, I’ve put together a plugin that fixes this issue. Download rails_fixes.zip and extract it to your vendor/plugins directory (to create a new rails_fixes directory). The plugin replaces the _insert_attributes method of Builder::XmlMarkup with one that escapes the values.

Timezone support in Ruby

Tuesday, August 30th, 2005

I spent some time at the weekend looking for a library in Ruby that would support converting times in UTC to particular named timezones, such as Europe/London or America/New_York, taking care of whether daylight savings was in force.

Unfortunately, I couldn’t find one, so I had to write my own instead. The result, TZInfo, is now available at RubyForge.

10 Things Every Java Programmer Should Know About Ruby

Wednesday, August 10th, 2005

10 Things Every Java Programmer Should Know About Ruby

A useful introduction to Ruby for Java programmers.