Monthly Archives: February 2009

Ruby Daemons: Verifying Good Behavior

If your ruby daemon isn’t doing something useful, it should be sleeping. A misbehaving daemon wakes up repeatedly, uses your CPU unnecessarily, and then goes back to sleep without doing anything helpful. It is easy to write a misbehaving daemon in Ruby, since you’re pretty well-insulated from what is actually happening at the operating system [...]

Tagged , | 1 Comment

Ruby: Overriding Class.new to make custom wrapper pattern

If you have a class Content and you call Content.new, you’ll get back an object of class Content. This is normal and expected. If you want something that is abnormal and unexpected to occur, this recipe is for you. While here we just implement a simple wrapper pattern, you could just as easily have Content.new [...]

Tagged , | 1 Comment