mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Replace RangeLookup.parse with RangeLookup.create
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user