From 88c8e231932041e0d34bb6d40eeb1e627048ad76 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 24 Jul 2009 02:05:39 +0200 Subject: nil <=> x results in 0 --- code/extensions/basic.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'code') diff --git a/code/extensions/basic.rb b/code/extensions/basic.rb index 5244a459..f7626ee9 100644 --- a/code/extensions/basic.rb +++ b/code/extensions/basic.rb @@ -165,6 +165,12 @@ class File::Stat end -class Object; def or(value) self end end -class NilClass; def or(value) value end end +class Object + def or(value) self end +end + +class NilClass + def or(value) value end + def <=>(value) 0 end +end -- cgit 1.4.1-2-gfad0