This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Ah, the joy of commit
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
While refactoring dir.c for Sapphire I realized, while trying to write some more test cases, that there was no Dir#closed? method. There's an IO#closed? method, which just tells you whether or not the stream is closed. So why wasn't there a Dir#closed? method.
No good reason really. It's not exactly something folks are yearning for in general. But, I needed it for testing, where I regularly do something like:
@handle.close if @handle && !@handle.closed?
Because trying to close a stream that's already closed raises an IOError.
So I added it. Just like that. I didn't have to have a 3 month long argument on the core list about it. I didn't have to wait 6 months for the next release to get it implemented. I just did it.