# Is there a Ruby library version problem with my ISP?

**URL:** <https://www.ruby-forum.com/t/is-there-a-ruby-library-version-problem-with-my-isp/80045>\
**Category:** Ruby\
**Created:** [December 20, 2006, 11:34pm UTC](https://www.ruby-forum.com/t/is-there-a-ruby-library-version-problem-with-my-isp/80045 "2006-12-20T23:34:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josselin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Josselin](https://www.ruby-forum.com/u/Josselin)\
**Post date:** [December 20, 2006, 11:34pm UTC](https://www.ruby-forum.com/t/is-there-a-ruby-library-version-problem-with-my-isp/80045/1 "2006-12-20T23:34:45Z")

</div>

I am running locally without any problem the following simple statement  
(detect first non-zero value…)

nb\_cities\_alphabet = [7, 21, 20, 1, 4, 1, 18, 3, 5, 1, 4, 48, 21, 8,  
0, 31, 6, 10, 47, 7, 0, 1, 0, 0, 0, 0]

```
  i = nb_cities_alphabet.index(nb_cities_alphabet.detect {|x| x > 

```

0})  
letter = (‘A’…‘Z’).to\_a[i]

but when running it with my ISP I get the error message :

NoMethodError : undefined method `detect’ for false:FalseClass

any idea why this error ? and why I don’t get it locally ?

if it’s actually a lib problem… any trick to replace it  
thanks a lot

joss

---

<div class="post-metadata">

**Author:** ![Josselin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Josselin](https://www.ruby-forum.com/u/Josselin)\
**Post date:** [December 21, 2006, 8:31am UTC](https://www.ruby-forum.com/t/is-there-a-ruby-library-version-problem-with-my-isp/80045/2 "2006-12-21T08:31:38Z")

</div>

On Dec 20, 2006, at 5:30 PM, Josselin wrote:

> but when running it with my ISP I get the error message :
> 
> NoMethodError : undefined method `detect’ for false:FalseClass
> 
> any idea why this error ? and why I don’t get it locally ?
> 
> if it’s actually a lib problem… any trick to replace it  
> thanks a lot

I don’t have any idea about what’s going wrong with your server, but  
you might try the following code. It’s a little more robust and  
efficient than what you are using now.

`
nb_cities_alphabet = [7, 21, 20, 1, 4, 1, 18, 3, 5, 1, 4, 48, 21, 8,
0, 31, 6, 10, 47, 7, 0, 1, 0, 0, 0, 0]
i = ?* - ?A
nb_cities_alphabet.each_with_index do |e, k|
if e > 0
i = k
break
end
end
letter = (i + ?A).chr
`

It will assign an asterisk (’\*’) to letter when there are no non-zero  
items in nb\_cities\_alphabet, which help with debugging.

Regards, Morton
