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)