Project

General

Profile

Actions

Bug #14257

closed

the chomp option removes newlines in additon to the provided separator for String#each_line and String#lines

Added by AaronLasseigne (Aaron Lasseigne) over 6 years ago. Updated about 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:84552]

Description

I'm not entirely sure this is a bug but I had a hard time finding anything that indicated that the change was on purpose.

The chomp option would remove the provided separator from each line. Now it does that and it also removes newlines.

2.4

> "a b c d\n".lines(' ', chomp: true)
=> ["a", "b", "c", "d\n"]

2.5

> "a b c d\n".lines(' ', chomp: true)
=> ["a", "b", "c", "d"]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0