blacklist inspect et al from being called on drops

This commit is contained in:
Tom Burns
2012-12-18 12:45:45 -05:00
parent 50bd34fd78
commit 9559d69e11

View File

@@ -20,9 +20,10 @@ module Liquid
# Your drop can either implement the methods sans any parameters or implement the before_method(name) method which is a
# catch all.
class Drop
attr_writer :context
EMPTY_STRING = ''.freeze
METHOD_BLACKLIST = [:dup, :clone, :singleton_class, :eval, :class_eval, :`, :inspect]
attr_writer :context
# Catch all for the method
def before_method(method)
@@ -47,5 +48,9 @@ module Liquid
end
alias :[] :invoke_drop
METHOD_BLACKLIST.each do |blacklisted|
define_method(blacklisted) {nil}
end
end
end