From c7033ff4c8c6e3a6836260316908b857fca9d495 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Mon, 13 Jun 2011 18:13:47 +0200 Subject: [PATCH] Avoid creating singleton classes on nil, true and false objects. Instead extend their respective classes. Just because those objects are singletons in current Ruby implementations doesn't mean we should rely on that. Fixes liquid on Maglev. --- lib/liquid/extensions.rb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/liquid/extensions.rb b/lib/liquid/extensions.rb index 2752ba37..24fc8e3f 100644 --- a/lib/liquid/extensions.rb +++ b/lib/liquid/extensions.rb @@ -43,14 +43,20 @@ class Date # :nodoc: end end -def true.to_liquid # :nodoc: - self +class TrueClass + def to_liquid # :nodoc: + self + end end -def false.to_liquid # :nodoc: - self +class FalseClass + def to_liquid # :nodoc: + self + end end -def nil.to_liquid # :nodoc: - self -end \ No newline at end of file +class NilClass + def to_liquid # :nodoc: + self + end +end