mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 09:05:13 -07:00
Move DEFAULT_OPTIONS related logic to Document
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
module Liquid
|
module Liquid
|
||||||
class Document < BlockBody
|
class Document < BlockBody
|
||||||
|
DEFAULT_OPTIONS = {
|
||||||
|
locale: I18n.new
|
||||||
|
}
|
||||||
|
|
||||||
def self.parse(tokens, options)
|
def self.parse(tokens, options)
|
||||||
doc = new
|
doc = new
|
||||||
doc.parse(tokens, options)
|
doc.parse(tokens, DEFAULT_OPTIONS.merge(options))
|
||||||
doc
|
doc
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,6 @@ module Liquid
|
|||||||
# template.render('user_name' => 'bob')
|
# template.render('user_name' => 'bob')
|
||||||
#
|
#
|
||||||
class Template
|
class Template
|
||||||
DEFAULT_OPTIONS = {
|
|
||||||
locale: I18n.new
|
|
||||||
}
|
|
||||||
|
|
||||||
attr_accessor :root
|
attr_accessor :root
|
||||||
attr_reader :resource_limits
|
attr_reader :resource_limits
|
||||||
|
|
||||||
@@ -120,7 +116,7 @@ module Liquid
|
|||||||
@options = options
|
@options = options
|
||||||
@profiling = options[:profile]
|
@profiling = options[:profile]
|
||||||
@line_numbers = options[:line_numbers] || @profiling
|
@line_numbers = options[:line_numbers] || @profiling
|
||||||
@root = Document.parse(tokenize(source), DEFAULT_OPTIONS.merge(options))
|
@root = Document.parse(tokenize(source), options)
|
||||||
@warnings = nil
|
@warnings = nil
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user