Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] eliminated nil-to-integer error when standard library ruby code calls make_tmpname with n=nil
@ 2011-02-21 21:17 Roni Choudhury
  2011-02-21 23:26 ` Alvaro Herrera
  0 siblings, 1 reply; 3+ messages in thread
From: Roni Choudhury @ 2011-02-21 21:17 UTC (permalink / raw)
  To: sup-devel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-22  0:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-21 21:17 [sup-devel] [PATCH] eliminated nil-to-integer error when standard library ruby code calls make_tmpname with n=nil Roni Choudhury
2011-02-21 23:26 ` Alvaro Herrera
2011-02-21 23:54   ` Roni Choudhury

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox