-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add String#each_line parameter remove_empty
#16232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add String#each_line parameter remove_empty
#16232
Conversation
|
I am concerned about handling "\n" lines when given |
|
The line itself is still empty? |
straight-shoota
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove_empty applies a filter, chomp defines how the items are presented.
The empty line filter should not be affected by whether non-empty lines end with a NL character or not.
Confusion that may happen is what is filtered with the It seems logical to apply the filter to lines, that's a "\n" line will be filtered out regardless of the |
String#each_line
String#each_lineString#each_line parameter remove_empty
Changes:
remove_emptyparameter for methoddef each_line(chomp : Bool = true, & : String ->) : Nilremove_emptyparameter for methoddef each_line(chomp = true)Closes #15149