Use named param format from liquid

This commit is contained in:
Mike Angell
2019-10-02 21:55:59 +10:00
parent f7076e1682
commit afbe7b930f
2 changed files with 11 additions and 8 deletions
+3 -2
View File
@@ -421,8 +421,9 @@ module Liquid
result.is_a?(BigDecimal) ? result.to_f : result
end
def default(input, default_value = '', allow_false: false)
if (allow_false ? input.nil? : !input) || (input.respond_to?(:empty?) && input.empty?)
def default(input, default_value = '', options = {})
options = {} unless options.is_a?(Hash)
if (options["allow_false"] == true ? input.nil? : !input) || (input.respond_to?(:empty?) && input.empty?)
default_value
else
input