Convert arguments to replace filters to strings to avoid exceptions.

This commit is contained in:
Dylan Thacker-Smith
2015-06-02 15:59:29 -04:00
parent be2e41e4d5
commit 94fe050952
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -167,12 +167,12 @@ module Liquid
# Replace occurrences of a string with another
def replace(input, string, replacement = ''.freeze)
input.to_s.gsub(string, replacement.to_s)
input.to_s.gsub(string.to_s, replacement.to_s)
end
# Replace the first occurrences of a string with another
def replace_first(input, string, replacement = ''.freeze)
input.to_s.sub(string, replacement.to_s)
input.to_s.sub(string.to_s, replacement.to_s)
end
# remove a substring