rubies: optimize code (run current once)

When you have a lot of rubies and run this code in a loop like this it
can get kind of slow (about 1 second). This makes sure current version
lookup is done only once.