Occasionally I Feel Stupid
Why? Well, other than the johnisms that my friends know me for, I just discovered
File.read tonight. Check out this dandy I wrote in the past:
begin file = File.open('file.txt', 'r') data = file.read ensure file.close end
Now that I am taking the time to read through the Standard Library, I’m having all kinds of “Oh, duh” moments. The easy way to do the above maneuver is:
data = File.read('file.txt')
So what is the lesson of the day? Get to know the Standard Library. Take some time to read through the various classes and get an overview of what they do. You don’t have to know all the details but knowing that they exist is sure to save you time (and beauty) in the future.