refactor confusing block + don't search the entire array

the functionality of Hash#select has changed in ruby 1.9. It now returns
a hash pairs whereas it used to return an array of pairs
Merge pull request #7 from mapleoin/refactor-ipaddress-block

refactor confusing block + don't search the entire array