Tuesday, October 28, 2008
When spec-ing something that calls method which takes a set of nested hashes (as many Rails methods do), it may be tempting to use #hash_including to test for only the values you care about. However #hash_including won’t work the way we might hope for nested hashes. Take the following (highly contrived) example:
describe CoffeeMaker […]
I hope to see some of you at Ruby DCamp this weekend!
Thursday, September 25, 2008
[RIP] Guy Decoux. – Ruby Forum
I’ll just repeat what I said on Ruby-talk – I’m very sad to hear this. His was one of the names that was, to me, synonymous with the Ruby community. He will be missed.
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
[…]
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 *?
=> […]
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 […]
One of my biggest pet peeves in doing QA is when I spend half a day trying to track down why a bug I thought I’d fixed has cropped up again, only to discover that the reporter was looking at an old version of the application. Good revision tracking is vital to doing efficient […]
Working as I do in the Rails world these days, I’m periodically reminded of the difference between me and most Rails programmers. That is, the fact that I came to Rails via Ruby, rather than vice-versa. Usually this happens when someone at work or in the blog world expresses delight (or perplexity) about […]
A passage in Charles Nutter’s reaction to MagLev caught my eye today:
First off, they demonstrated its distributed object database automatically synchronizing globally-reachable state across multiple VMs. It’s an amazing new idea that the world has never really seen…
except that it isn’t. This is based on existing OODB technology that Gemstone and others have been promoting […]
Sure, monkey patching is great and all. That period of disbelief, followed by increasing exasperation as the victim maintenance programmer discovers that an object is behaving differently than it’s source code says it should, is satisfying. But sooner or later he or she wises up and greps through the codebase, discovers where you […]