Closed excid3 closed 3 years ago
I'll have to revert this PR since it changes the behavior when the regexp contains capture. split
returns the capture inside the array of split strings, so we can't know with the current implementation what is the after and before the regexp.
I ran into some unexpected behavior today with
insert_into_file
. I was trying to insert, null: false
into a migration after some text, but nothing happened.This does nothing because
, null: false
exists in the file (anywhere).Using
after:
I would expectinsert_into_file
to only care if the string exists after the matching line, not before it.This PR would change the behavior to only look through the before or after portions of the file content to make it more intuitive.