Replace RangeLookup.parse with RangeLookup.create

This commit is contained in:
Charles-P. Clermont
2026-01-26 16:52:17 -05:00
parent 288c4eaac3
commit af774ebc55
2 changed files with 11 additions and 9 deletions
+10 -6
View File
@@ -48,12 +48,16 @@ module Liquid
end
def inner_parse(markup, ss, cache)
if markup.start_with?("(") && markup.end_with?(")") && markup =~ RANGES_REGEX
return RangeLookup.parse(
Regexp.last_match(1),
Regexp.last_match(2),
ss,
cache,
if (markup.start_with?("(") && markup.end_with?(")")) && markup =~ RANGES_REGEX
start_markup = Regexp.last_match(1)
end_markup = Regexp.last_match(2)
start_obj = parse(start_markup, ss, cache)
end_obj = parse(end_markup, ss, cache)
return RangeLookup.create(
start_obj,
end_obj,
start_markup,
end_markup,
)
end
+1 -3
View File
@@ -2,9 +2,7 @@
module Liquid
class RangeLookup
def self.parse(start_markup, end_markup, string_scanner, cache = nil)
start_obj = Expression.parse(start_markup, string_scanner, cache)
end_obj = Expression.parse(end_markup, string_scanner, cache)
def self.create(start_obj, end_obj, start_markup, end_markup)
if start_obj.respond_to?(:evaluate) || end_obj.respond_to?(:evaluate)
new(start_obj, end_obj)
else