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