Allow filters to redefine Object methods to make them invokable.

This commit is contained in:
Dylan Thacker-Smith
2015-02-03 13:51:33 -05:00
parent 3476a556dd
commit 950f062041
5 changed files with 50 additions and 50 deletions
+2 -15
View File
@@ -44,21 +44,8 @@ module Liquid
# for that
def add_filters(filters)
filters = [filters].flatten.compact
filters.each do |f|
raise ArgumentError, "Expected module but got: #{f.class}" unless f.is_a?(Module)
Strainer.add_known_filter(f)
end
# If strainer is already setup then there's no choice but to use a runtime
# extend call. If strainer is not yet created, we can utilize strainers
# cached class based API, which avoids busting the method cache.
if @strainer
filters.each do |f|
strainer.extend(f)
end
else
@filters.concat filters
end
@filters += filters
@strainer = nil
end
# are there any not handled interrupts?