From 3a907a4db7e144dd4957d925993f357b109d068d Mon Sep 17 00:00:00 2001 From: Gaurav Chande Date: Wed, 3 Jun 2015 19:42:16 +0000 Subject: [PATCH] Move DEFAULT_OPTIONS related logic to Document --- lib/liquid/document.rb | 6 +++++- lib/liquid/template.rb | 6 +----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/liquid/document.rb b/lib/liquid/document.rb index 7ecced6e..c964ae84 100644 --- a/lib/liquid/document.rb +++ b/lib/liquid/document.rb @@ -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 diff --git a/lib/liquid/template.rb b/lib/liquid/template.rb index 05b4114d..7b2897d9 100644 --- a/lib/liquid/template.rb +++ b/lib/liquid/template.rb @@ -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