[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sup-devel] [PATCH] eliminated nil-to-integer error when standard library ruby code calls make_tmpname with n=nil



I was getting an error from monkeypatched code that didn't seem to
call into the standard library properly... this patch seemed to fix
things for me, but I didn't fully understand what was going on here.

roni

---
 lib/sup/message-chunks.rb |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index c275f41..90137da 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -34,7 +34,11 @@ require 'tempfile'
 ## monkey-patch time: make temp files have the right extension
 class Tempfile
   def make_tmpname basename, n
-    sprintf '%d-%d-%s', $$, n, basename
+    if n == nil
+      sprintf '%d-nil-%s', $$, basename
+    else
+      sprintf '%d-%d-%s', $$, n, basename
+    end
   end
 end
 
-- 
1.7.3.2
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel