From f6eacbf875109457798ee663e52d3a82c44ac187 Mon Sep 17 00:00:00 2001 From: Tristan Hume Date: Wed, 31 Jul 2013 09:49:31 -0400 Subject: [PATCH] Add prayer for forgiveness. --- lib/liquid/tag.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/liquid/tag.rb b/lib/liquid/tag.rb index db6b754..2fe17c9 100644 --- a/lib/liquid/tag.rb +++ b/lib/liquid/tag.rb @@ -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)