[Xfce4-commits] <eatmonkey:aria2-xml-rpc> Update Array#count in compat18
Mike Massonnet
noreply at xfce.org
Thu Feb 11 22:58:04 CET 2010
Updating branch refs/heads/aria2-xml-rpc
to e971e0a6229806185db22757413d5b0d1d1e10fa (commit)
from c3f200fa4cc5a1fee12e1f171eaa15011237601d (commit)
commit e971e0a6229806185db22757413d5b0d1d1e10fa
Author: Mike Massonnet <mmassonnet at xfce.org>
Date: Wed Feb 10 02:51:13 2010 +0100
Update Array#count in compat18
Array#count falls back on nitems from Ruby 1.8, however this one has
been totally dropped in Ruby 1.9 so we have to check if it is defined to
make sure we can call it, otherwise make a call to count from the
parent.
src/compat18.rb | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/compat18.rb b/src/compat18.rb
index c35d1e1..3768ae5 100644
--- a/src/compat18.rb
+++ b/src/compat18.rb
@@ -1,6 +1,10 @@
class Array
def count()
- nitems()
+ if defined? nitems
+ return nitems
+ else
+ return super
+ end
end
def find_index(idx)
index(idx)
More information about the Xfce4-commits
mailing list