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

[sup-talk] [PATCH] Remove use of Object tap method



Remove ruby 1.9-ism in buffer.rb.  This keeps things running on older
ruby versions.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---
 lib/sup/buffer.rb |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index 5772bb0..ccbd38f 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -612,7 +612,12 @@ EOS
       tf.deactivate
       draw_screen :sync => false, :status => status, :title => title
     end
-    tf.value.tap { |x| x.force_encoding Encoding::UTF_8 if x && x.respond_to?(:encoding) }
+
+    v = if tf.value && tf.value.respond_to?(:encoding)
+          tf.value.force_encoding Encoding::UTF_8
+        else
+          tf.value
+        end
   end
 
   def ask_getch question, accept=nil
-- 
1.7.0

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk