mirror of
https://github.com/kemko/liquid.git
synced 2026-01-07 10:45:42 +03:00
Add prayer for forgiveness.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user