Sha256: a8c41490c7477c957749e4409e1760217092beae5f7bac7b585ed47aaf6c5e83
Contents?: true
Size: 802 Bytes
Versions: 2
Compression:
Stored size: 802 Bytes
Contents
require 'enumerator' module Google module Scholar class AuthorEnumerator include Enumerable def initialize(scraper) @scraper = scraper @documents = scraper.documents self end def each current_document = @documents.first i = 1 while(current_document) current_document.authors.each {|author| yield(author)} if(@documents.length > i) current_document = @documents[i] else if(@scraper.has_more_pages?) @scraper.load_next_page @documents = @scraper.documents current_document = @documents[i] else current_document = nil end end i += 1 end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
google-scholar-0.0.2 | lib/google/scholar/author_enumerator.rb |
google-scholar-0.0.1 | lib/google/scholar/author_enumerator.rb |