mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 11:20:41 -07:00
Instantiate blank string once instead of at every comparison
This commit is contained in:
+3
-1
@@ -22,6 +22,8 @@ module Liquid
|
|||||||
class Drop
|
class Drop
|
||||||
attr_writer :context
|
attr_writer :context
|
||||||
|
|
||||||
|
EMPTY_STRING = ''.freeze
|
||||||
|
|
||||||
# Catch all for the method
|
# Catch all for the method
|
||||||
def before_method(method)
|
def before_method(method)
|
||||||
nil
|
nil
|
||||||
@@ -29,7 +31,7 @@ module Liquid
|
|||||||
|
|
||||||
# called by liquid to invoke a drop
|
# called by liquid to invoke a drop
|
||||||
def invoke_drop(method_or_key)
|
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)
|
send(method_or_key.to_s.to_sym)
|
||||||
else
|
else
|
||||||
before_method(method_or_key)
|
before_method(method_or_key)
|
||||||
|
|||||||
Reference in New Issue
Block a user