Instantiate blank string once instead of at every comparison

This commit is contained in:
Tom Burns
2012-10-25 11:54:19 -04:00
parent ce76dbf8d9
commit 6c2fde5eea
+3 -1
View File
@@ -22,6 +22,8 @@ module Liquid
class Drop
attr_writer :context
EMPTY_STRING = ''.freeze
# Catch all for the method
def before_method(method)
nil
@@ -29,7 +31,7 @@ module Liquid
# called by liquid to invoke a drop
def invoke_drop(method_or_key)
if method_or_key && method_or_key != '' && self.class.public_method_defined?(method_or_key.to_s.to_sym)
if method_or_key && method_or_key != EMPTY_STRING && self.class.public_method_defined?(method_or_key.to_s.to_sym)
send(method_or_key.to_s.to_sym)
else
before_method(method_or_key)