add global_filter

add a global filter using a proc
only add one proc and not an array
add tests to make sure the global_filter is applied after native filters
This commit is contained in:
Loren Hale
2015-07-12 16:46:43 +08:00
parent b42d35ff36
commit 0b11b573d9
5 changed files with 49 additions and 15 deletions
+7 -12
View File
@@ -179,20 +179,15 @@ module Liquid
when Hash
options = args.pop
if options[:registers].is_a?(Hash)
registers.merge!(options[:registers])
end
registers.merge!(options[:registers]) if options[:registers].is_a?(Hash)
if options[:filters]
context.add_filters(options[:filters])
end
context.add_filters(options[:filters]) if options[:filters]
if options[:exception_handler]
context.exception_handler = options[:exception_handler]
end
when Module
context.add_filters(args.pop)
when Array
context.global_filter = options[:global_filter] if options[:global_filter]
context.exception_handler = options[:exception_handler] if options[:exception_handler]
when Module, Array
context.add_filters(args.pop)
end