D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
IO
/
Filename :
readlines-i.ri
back
Copy
U:RDoc::AnyMethod[iI"readlines:ETI"IO#readlines;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I";Reads and returns all remaining line from the stream; ;TI""does not modify <tt>$_</tt>. ;TI"(See {Line IO}[rdoc-ref:IO@Line+IO].;To:RDoc::Markup::BlankLine o; ; [I",With no arguments given, returns lines ;TI"Cas determined by line separator <tt>$/</tt>, or +nil+ if none:;T@o:RDoc::Markup::Verbatim; [ I"f = File.new('t.txt') ;TI"f.readlines ;TI"S# => ["First line\n", "Second line\n", "\n", "Fourth line\n", "Fifth line\n"] ;TI"f.readlines # => [] ;TI" f.close ;T:@format0o; ; [ I",With only string argument +sep+ given, ;TI":returns lines as determined by line separator +sep+, ;TI"or +nil+ if none; ;TI"6see {Line Separator}[rdoc-ref:IO@Line+Separator]:;T@o;; [ I"f = File.new('t.txt') ;TI"f.readlines('li') ;TI"S# => ["First li", "ne\nSecond li", "ne\n\nFourth li", "ne\nFifth li", "ne\n"] ;TI" f.close ;T; 0o; ; [I"2The two special values for +sep+ are honored:;T@o;; [I"f = File.new('t.txt') ;TI" # Get all into one string. ;TI"f.readlines(nil) ;TI"C# => ["First line\nSecond line\n\nFourth line\nFifth line\n"] ;TI"3# Get paragraphs (up to two line separators). ;TI"f.rewind ;TI"f.readlines('') ;TI"G# => ["First line\nSecond line\n\n", "Fourth line\nFifth line\n"] ;TI" f.close ;T; 0o; ; [I"/With only integer argument +limit+ given, ;TI".limits the number of bytes in each line; ;TI".see {Line Limit}[rdoc-ref:IO@Line+Limit]:;T@o;; [ I"f = File.new('t.txt') ;TI"f.readlines(8) ;TI"c# => ["First li", "ne\n", "Second l", "ine\n", "\n", "Fourth l", "ine\n", "Fifth li", "ne\n"] ;TI" f.close ;T; 0o; ; [I"-With arguments +sep+ and +limit+ given, ;TI" combines the two behaviors ;TI"V(see {Line Separator and Line Limit}[rdoc-ref:IO@Line+Separator+and+Line+Limit]).;T@o; ; [I"IOptional keyword argument +chomp+ specifies whether line separators ;TI"are to be omitted:;T@o;; [ I"f = File.new('t.txt') ;TI"f.readlines(chomp: true) ;TI"I# => ["First line", "Second line", "", "Fourth line", "Fifth line"] ;TI"f.close;T; 0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"�readlines(sep = $/, chomp: false) -> array readlines(limit, chomp: false) -> array readlines(sep, limit, chomp: false) -> array ;T0[ I"(*args);T@PFI"IO;TcRDoc::NormalClass00