Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Avoid creating singleton classes on nil, true and false objects #60

Merged
merged 1 commit into from

2 participants

Tim Felgentreff Tobias Lütke
Tim Felgentreff

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.

Tim Felgentreff timfel Avoid creating singleton classes on nil, true and false objects. Inst…
…ead 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.
c7033ff
Tobias Lütke tobi merged commit 98c96ed into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 13, 2011
  1. Tim Felgentreff

    Avoid creating singleton classes on nil, true and false objects. Inst…

    timfel authored
    …ead 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.
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 7 deletions.
  1. +13 −7 lib/liquid/extensions.rb
20 lib/liquid/extensions.rb
View
@@ -43,14 +43,20 @@ def to_liquid
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
+class NilClass
+ def to_liquid # :nodoc:
+ self
+ end
+end
Something went wrong with that request. Please try again.