Class: Google::Scholar::Author
- Inherits:
-
Object
- Object
- Google::Scholar::Author
- Defined in:
- lib/google/scholar/author.rb
Instance Method Summary collapse
- #articles ⇒ Object
- #author_url ⇒ Object
- #citation_count ⇒ Object
- #citations ⇒ Object
- #full_profile ⇒ Object
- #id ⇒ Object
-
#initialize(document) ⇒ Author
constructor
A new instance of Author.
- #name ⇒ Object
Constructor Details
#initialize(document) ⇒ Author
Returns a new instance of Author.
5 6 7 |
# File 'lib/google/scholar/author.rb', line 5 def initialize(document) @summary_doc = document end |
Instance Method Details
#articles ⇒ Object
26 27 28 |
# File 'lib/google/scholar/author.rb', line 26 def articles @articles ||= Google::Scholar::ArticleEnumerator.new(Google::Scholar::Scraper.new(nil,self.full_profile)) end |
#author_url ⇒ Object
14 15 16 |
# File 'lib/google/scholar/author.rb', line 14 def @author_url ||= "#{Google::Scholar.google_url}#{@summary_doc.css("td:last a").first.attr("href")}&pagesize=100" end |
#citation_count ⇒ Object
11 12 13 |
# File 'lib/google/scholar/author.rb', line 11 def citation_count @citation_count ||= @summary_doc.css("td:last").children.reject{|x| !x.text?}.last.text.split(" ").last.to_i end |
#citations ⇒ Object
20 21 22 |
# File 'lib/google/scholar/author.rb', line 20 def citations full_profile.css("#stats td.cit-data").first.text.to_i end |
#full_profile ⇒ Object
17 18 19 |
# File 'lib/google/scholar/author.rb', line 17 def full_profile @full_profile ||= Google::Scholar::Scraper.new().documents.first end |
#id ⇒ Object
23 24 25 |
# File 'lib/google/scholar/author.rb', line 23 def id @id ||= @summary_doc.css("td:last a:first").attr("href").to_s.match(/user=(.*)&/)[1] end |
#name ⇒ Object
8 9 10 |
# File 'lib/google/scholar/author.rb', line 8 def name @name ||= @summary_doc.css("td:last a:first").text.strip.gsub('\n','') end |