|
|
|
|
|
by kyberias
3741 days ago
|
|
Out of curiosity (haven't done ruby for awhile): is your line-by-line implementation safe? Is it guaranteed that the lines are identical in the output file besides the character you're replacing? I'm thinking different CR+LR combinations. What if the final line is not terminated by newline? Doesn't print always add it? |
|
'print' does not
The code does handle/preserve all the cases you mentioned (\r\n, final or no final terminating newline, etc).