From 8736b602ea2fa304d480dd80c6139b74e83569b7 Mon Sep 17 00:00:00 2001 From: Thierry Joyal Date: Thu, 2 Apr 2015 13:16:07 +0000 Subject: [PATCH] Explode invokable_methods method on Liquid::Drop --- lib/liquid/drop.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/liquid/drop.rb b/lib/liquid/drop.rb index e4880c4..58d07a0 100644 --- a/lib/liquid/drop.rb +++ b/lib/liquid/drop.rb @@ -62,6 +62,10 @@ module Liquid # Check for method existence without invoking respond_to?, which creates symbols def self.invokable?(method_name) + self.invokable_methods.include?(method_name.to_s) + end + + def self.invokable_methods unless @invokable_methods blacklist = Liquid::Drop.public_instance_methods + [:each] if include?(Enumerable) @@ -71,7 +75,7 @@ module Liquid whitelist = [:to_liquid] + (public_instance_methods - blacklist) @invokable_methods = Set.new(whitelist.map(&:to_s)) end - @invokable_methods.include?(method_name.to_s) + @invokable_methods end end end