readlines 2

ios.readlines(sep=$/) â array
ios.readlines(limit) â array
ios.readlines(sep, limit) â array
Instance Public methods

Reads all of the lines in ios, and returns them in anArray. Lines are separated by the optional sep. If sep is nil, the rest of the stream is returned as a single record. If the first argument is an integer, or optional second argument is given, the returning string would not be longer than the given value in bytes. The stream must be opened for reading or an IOError will be raised.

f = File.new("testfile")
f.readlines[0]   #=> "This is line one\n"
doc_ruby_on_rails
2015-04-13 13:51:46
Comments
Leave a Comment

Please login to continue.