Add default filter to standard filters

This commit is contained in:
Derrick Reimer
2013-10-09 16:07:32 -07:00
parent a25ed17e2b
commit 5db1695694
2 changed files with 14 additions and 0 deletions
+5
View File
@@ -245,6 +245,11 @@ module Liquid
apply_operation(input, operand, :%)
end
def default(input, default_value = "")
is_blank = input.respond_to?(:empty?) ? input.empty? : !input
is_blank ? default_value : input
end
private
def flatten_if_necessary(input)