(maint) Fix spec failure in Ruby 1.8.5 due to Array#count

Without this patch the examples fail with Ruby 1.8.5 because Array#count
is called and this method is not defined in this version of Ruby.  This
patch fixes the problem by calling Array#length instead.