From 9559d69e11b9edaecf8e73b1a0bf5c9f7d2a6663 Mon Sep 17 00:00:00 2001 From: Tom Burns Date: Tue, 18 Dec 2012 12:45:45 -0500 Subject: [PATCH] blacklist inspect et al from being called on drops --- lib/liquid/drop.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/liquid/drop.rb b/lib/liquid/drop.rb index ee2a4d7..58cdc00 100644 --- a/lib/liquid/drop.rb +++ b/lib/liquid/drop.rb @@ -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