Class: Google::Scholar::AuthorsDocument

Inherits:
Document
  • Object
show all
Defined in:
lib/google/scholar/document/authors_document.rb

Instance Attribute Summary

Attributes inherited from Document

#document

Instance Method Summary collapse

Methods inherited from Document

#has_next_page?, #initialize, #method_missing, #next_page_url

Constructor Details

This class inherits a constructor from Google::Scholar::Document

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Google::Scholar::Document

Instance Method Details

#authors(force = false) ⇒ Object



14
15
16
17
18
19
# File 'lib/google/scholar/document/authors_document.rb', line 14

def authors(force=false)
  return @authors if @authors && !force
  @authors = []
  self.css('.g-unit').each {|author| @authors << Google::Scholar::Author.new(author)}
  @authors
end

#authors_countObject



11
12
13
# File 'lib/google/scholar/document/authors_document.rb', line 11

def authors_count
  self.css('.g-unit').length
end

#last_authorObject



20
21
22
# File 'lib/google/scholar/document/authors_document.rb', line 20

def last_author
  authors.last
end

#valid?Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'lib/google/scholar/document/authors_document.rb', line 6

def valid?
  validity = !self.content.downcase.index("authors").nil?
  validity = false if !self.content.downcase.index("didn't match any").nil?
  validity
end