Skip to content

Commit 8660501

Browse files
authored
Add Liquid::VariableLookup#lookup_command? to expose this parse node state (#1583)
1 parent 6981305 commit 8660501

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/liquid/variable_lookup.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ def initialize(markup)
3232
end
3333
end
3434

35+
def lookup_command?(lookup_index)
36+
@command_flags & (1 << lookup_index) != 0
37+
end
38+
3539
def evaluate(context)
3640
name = context.evaluate(@name)
3741
object = context.find_variable(name)
@@ -55,7 +59,7 @@ def evaluate(context)
5559
# Some special cases. If the part wasn't in square brackets and
5660
# no key with the same name was found we interpret following calls
5761
# as commands and call them on the current object
58-
elsif @command_flags & (1 << i) != 0 && object.respond_to?(key)
62+
elsif lookup_command?(i) && object.respond_to?(key)
5963
object = object.send(key).to_liquid
6064

6165
# No key was present with the desired value and it wasn't one of the directly supported

0 commit comments

Comments
 (0)