gsub(/suffix\z/, '')
can be replaced by delete_suffix('suffix')
RB-PR1027The delete_suffix('suffix')
method is faster than gsub(/suffix\z/, '')
.
str.gsub(/suffix\z/, '')
str.gsub!(/suffix\z/, '')
str.gsub(/suffix$/, '')
str.gsub!(/suffix$/, '')
str.delete_suffix('suffix')
str.delete_suffix!('suffix')