On Aug 23, 3:32 ¨Βν¬ ΒςιαΓαξδμεΌβ®γαξδ®®®ΐποβοψ®γονχςοτεΊ > Thomas Sawyer wrote: > > Ruby 1.8.7 p72 > > > >> "A\nB\nC".lines.to_a > > => ["A\n", "B\n", "C"] > > > Please, tell me that's a mishap, and not how 1.9 works. I'd expect: > > > >> "A\nB\nC".lines.to_a > > => ["A", "B", "C"] > > Why would you expect that? The documentation is very clear. > > --------------------------------------------------------------- IO#lines > ¨Βοσ®μιξεσ¨σε𽤯© ½Ύ αξΕξυνεςατος > ¨Βοσ®μιξεσ¨μινιταξΕξυνεςατος > ¨Βοσ®μιξεσ¨σεπμινιτ© ½Ύ αξΕξυνεςατος > ------------------------------------------------------------------------ > ¨Βετυςξσ αξ εξυνεςατος τθατ ηιφεεαγθ μιξε ιξ ίιοσί® Τθστςεαν > ¨Βυσβε οπεξεδ ζοςεαδιξος αξ «ΙΟΕςςοςχιμμ βε ςαισεδ> > f = File.new("testfile") > f.lines.to_a => ["foo\n", "bar\n"] > f.rewind > f.lines.sort => ["bar\n", "foo\n"] > > If it changed in 1.9, that would be another source of incompatibilities. > > Perhaps most importantly of all, if the newlines were stripped, there > would be loss of data and it would be impossible to reconstruct the > original file exactly from the members of the lines array (e.g. > lines.join), as your example shows nicely. I'd expect it from a StringIO, but not a String. T.