thank you guys!
i really appreciate this.

i'm sorry if my question wasn't understandable. main reason for this 
purpose is consistent hashing, where we need to find for example next 
bigger key in array comparing to the "needle".

i haven't tested yet your solutions but i will.
hope this topic helps for someone in future.

i'm also googled and find this:

https://github.com/superfeedr/consistent_hashr/blob/master/lib/consistent_hashr.rb

but i'm not sure that this is efficient way of doing things if we have 
for example 10k elements in array.

-- 
Posted via http://www.ruby-forum.com/.