Sha256: e8ddf0e7ebb902534a603539701d1bd8b5a8d135c346135459c230b09a4bf372
Contents?: true
Size: 806 Bytes
Versions: 2
Compression:
Stored size: 806 Bytes
Contents
require 'enumerator' module Google module Scholar class ArticleEnumerator 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.articles.each {|article| yield(article)} 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/article_enumerator.rb |
google-scholar-0.0.1 | lib/google/scholar/article_enumerator.rb |