Skip to content

Commit bc2a515

Browse files
committed
Replace RangeLookup.parse with RangeLookup.create
1 parent c05f163 commit bc2a515

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

lib/liquid/expression.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,16 @@ def parse(markup, ss = StringScanner.new(""), cache = nil)
4848
end
4949

5050
def inner_parse(markup, ss, cache)
51-
if markup.start_with?("(") && markup.end_with?(")") && markup =~ RANGES_REGEX
52-
return RangeLookup.parse(
53-
Regexp.last_match(1),
54-
Regexp.last_match(2),
55-
ss,
56-
cache,
51+
if (markup.start_with?("(") && markup.end_with?(")")) && markup =~ RANGES_REGEX
52+
start_markup = Regexp.last_match(1)
53+
end_markup = Regexp.last_match(2)
54+
start_obj = parse(start_markup, ss, cache)
55+
end_obj = parse(end_markup, ss, cache)
56+
return RangeLookup.create(
57+
start_obj,
58+
end_obj,
59+
start_markup,
60+
end_markup,
5761
)
5862
end
5963

lib/liquid/range_lookup.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
module Liquid
44
class RangeLookup
5-
def self.parse(start_markup, end_markup, string_scanner, cache = nil)
6-
start_obj = Expression.parse(start_markup, string_scanner, cache)
7-
end_obj = Expression.parse(end_markup, string_scanner, cache)
5+
def self.create(start_obj, end_obj, start_markup, end_markup)
86
if start_obj.respond_to?(:evaluate) || end_obj.respond_to?(:evaluate)
97
new(start_obj, end_obj)
108
else

0 commit comments

Comments
 (0)