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 end
def inner_parse(markup, ss, cache) def inner_parse(markup, ss, cache)
if markup.start_with?("(") && markup.end_with?(")") && markup =~ RANGES_REGEX if (markup.start_with?("(") && markup.end_with?(")")) && markup =~ RANGES_REGEX
return RangeLookup.parse( start_markup = Regexp.last_match(1)
Regexp.last_match(1), end_markup = Regexp.last_match(2)
Regexp.last_match(2), start_obj = parse(start_markup, ss, cache)
ss, end_obj = parse(end_markup, ss, cache)
cache, return RangeLookup.create(
start_obj,
end_obj,
start_markup,
end_markup,
) )
end end
+1 -3
View File
@@ -2,9 +2,7 @@
module Liquid module Liquid
class RangeLookup class RangeLookup
def self.parse(start_markup, end_markup, string_scanner, cache = nil) def self.create(start_obj, end_obj, start_markup, end_markup)
start_obj = Expression.parse(start_markup, string_scanner, cache)
end_obj = Expression.parse(end_markup, string_scanner, cache)
if start_obj.respond_to?(:evaluate) || end_obj.respond_to?(:evaluate) if start_obj.respond_to?(:evaluate) || end_obj.respond_to?(:evaluate)
new(start_obj, end_obj) new(start_obj, end_obj)
else else