From 19c3db8c0d06857bc4ee880185748ab6926fb0cc Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 4 Apr 2009 10:47:24 +0200 Subject: [PATCH] Backport Integer#odd? to older Ruby versions As pointed out by a private communication from Ben Jackson, Integer#odd? was introduced in Ruby 1.8.7; to make the script runnable on older Ruby versions, we define the method ourselves if it's missing. --- rcs-fast-export.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rcs-fast-export.rb b/rcs-fast-export.rb index ebc6251..666f06d 100755 --- a/rcs-fast-export.rb +++ b/rcs-fast-export.rb @@ -2,6 +2,16 @@ require 'pp' +# Integer#odd? was introduced in Ruby 1.8.7, backport it to +# older versions +unless 2.respond_to? :odd? + class Integer + def odd? + self % 2 == 1 + end + end +end + def usage STDERR.puts <