Skip to content

Monthly Archives: August 2008

Class.new and .inherited()

In Ruby, the typical way to define a class is using the class keyword:

class Foo # …
end

The class keyword, however, is effectively just syntax sugar for the Class constructor:

Foo = Class.new # …
end

Using Class.new is occasionally preferable, e.g. when you want an anonymous class which isn’t assigned to a constant:

@myclass = Class.new […]

Switching to Disqus

I’ve been pretty unsatisfied with the default WordPress commenting system for a number of reasons. And I’ve received several complaints about the way OpenID was being handled in comments. I’ve switched the comments over to being managed by Disqus. Hopefully this will address the issues and be more convenient for all concerned.

Always something new

After 5-6+ years of working with Ruby, I am still periodically reminded of features I’d forgotten about. Today it was the fact that you can override the backtick operator:

>> def `(cmd)
>> puts "Do you really want to #{cmd}?"
>> end
=> nil
>> `rm -rf *`
Do you really want to rm -rf *?
=> […]

The Trifecta of FAIL; or, how to patch Rails 2.0 for Ruby 1.8.7

It’s an oft-stated fact that most disasters result not from a single point of failure but from a combination of failures reinforcing each other. I wouldn’t term the problem I ran into last Friday a disaster, but it certainly cost me several hours of time trying to find a workaround.

Culprit #1: Rails

Rails’ ActiveSupport added […]

Contact Info Survey

Loading…