Add prayer for forgiveness.

This commit is contained in:
Tristan Hume
2013-07-31 09:49:31 -04:00
parent c5afdc529a
commit f6eacbf875

View File

@@ -3,6 +3,14 @@ module Liquid
attr_accessor :nodelist, :options
def self.new_with_options(tag_name, markup, tokens, options)
# Forgive me Matz for I have sinned.
# I have forsaken the holy idioms of Ruby and used Class#allocate.
# I fulfilled my mandate by maintaining API compatibility and performance,
# even though it may displease your Lordship.
#
# In all seriousness though, I can prove to a reasonable degree of certainty
# that setting options before calling initialize is required to maintain API compatibility.
# I tried doing it without it and not only did I break compatibility, it was much slower.
new_tag = self.allocate
new_tag.options = options
new_tag.send(:initialize, tag_name, markup, tokens)