mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Fix Liquid::Template inheritance (#1227)
self.class.default_resource_limits would return `nil` in a subclass, since the attribute isn't set on subclasses.
This commit is contained in:
committed by
GitHub
parent
9c538f4237
commit
e9b649b345
@@ -119,14 +119,13 @@ module Liquid
|
||||
# To enable profiling, pass in <tt>profile: true</tt> as an option.
|
||||
# See Liquid::Profiler for more information
|
||||
def parse(source, options = {})
|
||||
template = Template.new
|
||||
template.parse(source, options)
|
||||
new.parse(source, options)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize
|
||||
@rethrow_errors = false
|
||||
@resource_limits = ResourceLimits.new(self.class.default_resource_limits)
|
||||
@resource_limits = ResourceLimits.new(Template.default_resource_limits)
|
||||
end
|
||||
|
||||
# Parse source code.
|
||||
|
||||
@@ -77,4 +77,11 @@ class TemplateUnitTest < Minitest::Test
|
||||
ensure
|
||||
Template.tags.delete('fake')
|
||||
end
|
||||
|
||||
class TemplateSubclass < Liquid::Template
|
||||
end
|
||||
|
||||
def test_template_inheritance
|
||||
assert_equal("foo", TemplateSubclass.parse("foo").render)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user