Skip to content

Instantly share code, notes, and snippets.

@verlane
Last active December 21, 2015 03:19
Show Gist options
  • Save verlane/6241780 to your computer and use it in GitHub Desktop.
Save verlane/6241780 to your computer and use it in GitHub Desktop.
Liquid 2.6 (Octopress)
diff --git a/lib/liquid/standardfilters.rb b/lib/liquid/standardfilters.rb
index b7f6418..70f10df 100644
--- a/lib/liquid/standardfilters.rb
+++ b/lib/liquid/standardfilters.rb
@@ -7,7 +7,6 @@ module Liquid
# Return the size of an array or of an string
def size(input)
-
input.respond_to?(:size) ? input.size : 0
end
@@ -61,7 +60,7 @@ module Liquid
# <div class="summary">{{ post | split '//' | first }}</div>
#
def split(input, pattern)
- input.split(pattern)
+ input.to_s.split(pattern)
end
def strip_html(input)
@@ -112,22 +111,22 @@ module Liquid
# Replace occurrences of a string with another
def replace(input, string, replacement = '')
- 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 = '')
- input.to_s.sub(string, replacement.to_s)
+ input.to_s.sub(string.to_s, replacement.to_s)
end
# remove a substring
def remove(input, string)
- input.to_s.gsub(string, '')
+ input.to_s.gsub(string.to_s, '')
end
# remove the first occurrences of a substring
def remove_first(input, string)
- input.to_s.sub(string, '')
+ input.to_s.sub(string.to_s, '')
end
# add one string to another
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment