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

[sup-devel] [PATCH] Conditionally define Fixnum#ord



Ruby 1.8.5 was throwing exceptions from lib/sup/util.rb line 650 due
to calling .ord on a Fixnum.  This patch defines Fixnum#ord if the
method doesn't exist already.  Helps on old ruby version (1.8.5 here).

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

diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index 5dadba1..861db7f 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -366,6 +366,12 @@ class Fixnum
     end
   end
 
+  unless method_defined?(:ord)
+    def ord
+      self
+    end
+  end
+
   ## hacking the english language
   def pluralize s
     to_s + " " +
-- 
1.6.6

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