This:
search = Google::Search::Web.new do |search|
search.query = "where is peru?"
search.size = :small
end
Creates a lazy enumerable object which only retrieves search results as you enumerate over them. Therefore this:
search.first(5)
Gets the first five searches; and this:
uris = search.first(5).map(&:uri)
Gets the first five uri's.
Change first(5)
to first(20)
and you'll see it take much longer to execute, which is consistent with the enumeration being lazy.