mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 09:05:13 -07:00
Add Liquid::VariableLookup#lookup_command? to expose this parse node state (#1583)
This commit is contained in:
@@ -32,6 +32,10 @@ module Liquid
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def lookup_command?(lookup_index)
|
||||||
|
@command_flags & (1 << lookup_index) != 0
|
||||||
|
end
|
||||||
|
|
||||||
def evaluate(context)
|
def evaluate(context)
|
||||||
name = context.evaluate(@name)
|
name = context.evaluate(@name)
|
||||||
object = context.find_variable(name)
|
object = context.find_variable(name)
|
||||||
@@ -55,7 +59,7 @@ module Liquid
|
|||||||
# Some special cases. If the part wasn't in square brackets and
|
# Some special cases. If the part wasn't in square brackets and
|
||||||
# no key with the same name was found we interpret following calls
|
# no key with the same name was found we interpret following calls
|
||||||
# as commands and call them on the current object
|
# as commands and call them on the current object
|
||||||
elsif @command_flags & (1 << i) != 0 && object.respond_to?(key)
|
elsif lookup_command?(i) && object.respond_to?(key)
|
||||||
object = object.send(key).to_liquid
|
object = object.send(key).to_liquid
|
||||||
|
|
||||||
# No key was present with the desired value and it wasn't one of the directly supported
|
# No key was present with the desired value and it wasn't one of the directly supported
|
||||||
|
|||||||
Reference in New Issue
Block a user