# File lib/geoip.rb, line 320
  def each
    return enum_for unless block_given?

    if (@database_type != GEOIP_CITY_EDITION_REV0 &&
        @database_type != GEOIP_CITY_EDITION_REV1)
      throw "Invalid GeoIP database type, can't iterate thru non-City database"
    end

    @iter_pos = @database_segments[0] + 1
    num = 0

    until ((rec = read_city(@iter_pos)).nil?)
      yield rec
      print "#{num}: #{@iter_pos}\n" if((num += 1) % 1000 == 0)
    end

    @iter_pos = nil
    return self
  end