October 21st, 2009, 04:16 PM
Where's the readline? And... The documentation for it?
Any ideas where there's good solid documentation on Ruby? I was reading up on the ins and outs on http://www.techotopia.com and wanted to know how to read from files... It showed me a few methods like File.open and File.new, I thought okay, I'll check out the Ruby API Documentation... And found http://ruby-doc.org/ so I thought, hey, this must be it...
I thought I'd take a look at 1.9 standard library since that was the version of Ruby I was running, and looked up the File class. I was a little surprised when the documentation didn't actually list the method "readline". What have I missed exactly? I'm looking at the File class... Is the tutorial site wrong? Is there a better source for Ruby documentation?
if($Tiredness > TIREDNESS_MAX) $CupOfTea++;
If you found what I've said helpful, I'm interested in reputation points!
October 25th, 2009, 12:27 AM
The method you are looking for is called File.gets(). Odd that the ruby-doc site shows documentation for the ftools module, not the core File class. When you require 'ftools', it will add extra methods to the File class.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo