Move DEFAULT_OPTIONS related logic to Document

This commit is contained in:
Gaurav Chande
2015-06-04 04:39:54 +00:00
parent 8b98f92c7f
commit 3a907a4db7
2 changed files with 6 additions and 6 deletions
+5 -1
View File
@@ -1,8 +1,12 @@
module Liquid
class Document < BlockBody
DEFAULT_OPTIONS = {
locale: I18n.new
}
def self.parse(tokens, options)
doc = new
doc.parse(tokens, options)
doc.parse(tokens, DEFAULT_OPTIONS.merge(options))
doc
end
+1 -5
View File
@@ -13,10 +13,6 @@ module Liquid
# template.render('user_name' => 'bob')
#
class Template
DEFAULT_OPTIONS = {
locale: I18n.new
}
attr_accessor :root
attr_reader :resource_limits
@@ -120,7 +116,7 @@ module Liquid
@options = options
@profiling = options[:profile]
@line_numbers = options[:line_numbers] || @profiling
@root = Document.parse(tokenize(source), DEFAULT_OPTIONS.merge(options))
@root = Document.parse(tokenize(source), options)
@warnings = nil
self
end