The use of String#delete_prefix!/delete_suffix! makes this method more readable.
It also makes possible to strip strings with more than one character.
Note that I am using the methods ending with ! to modify value, this matches the already used strip!.
I also modified the early return to show that value is always returned, and with this PR all value modifications happen in-place.
This could be used to further simplify the method itself (no need to return a value) and the single usage I have found in Parser#parse_no_quote: line = strip_value(line) to strip_value(line).
I have not done this modification yet to leave it open for discussion.
The use of
String#delete_prefix!/delete_suffix!
makes this method more readable. It also makes possible to strip strings with more than one character.Note that I am using the methods ending with
!
to modifyvalue
, this matches the already usedstrip!
. I also modified the early return to show thatvalue
is always returned, and with this PR allvalue
modifications happen in-place. This could be used to further simplify the method itself (no need to return a value) and the single usage I have found inParser#parse_no_quote
:line = strip_value(line)
tostrip_value(line)
.I have not done this modification yet to leave it open for discussion.