Shopify/liquid — pull request #321 by dylanahsmith (2014-03-18 22:00:36+00:00)
Title: Refactor to create tags with a parse class method instead of new.

@trishume, @tobi, @shopify/liquid for review

## Problem

The Tag base class was calling parse in the initializer to parse the tag body. This prevented super from being called at the start of the initializer of subclasses, yet the initializer is also used for parsing the tag itself. This prevented a natural way of the base Tag class to initialize the options instance variable before subclasses depended on it, leading to allocate being used to make the options available to subclasses for tag parsing.

## Solution

Avoid calling parse in the initializer, then have the subclasses of Tag call super at the top of the initializer. Now the subclasses can depend on the superclass being fully initialized while parsing the tag markup.

To avoid the unparsed tag state, a parse class method was added which calls `new`, and `new` was made private.

I removed the allocate method and changed the signature of initializer, since we are already planning a major version bump for the next release, so this is a good time to make breaking API changes.