Refactor to create tags with a parse class method instead of new.

By moving parse out of the initializer, we can call super at the start of
the initializers for subclasses, and avoid the nasty allocate hack.
This commit is contained in:
Dylan Thacker-Smith
2014-03-20 16:10:10 -04:00
parent e190bbba9e
commit d4ecaff8b8
18 changed files with 44 additions and 49 deletions
+3 -4
View File
@@ -1,9 +1,8 @@
module Liquid
class Document < Block
# we don't need markup to open this block
def initialize(tokens, options = {})
@options = options
parse(tokens)
def self.parse(tokens, options={})
# we don't need markup to open this block
super(nil, nil, tokens, options)
end
# There isn't a real delimiter