Sha256: 64612b764ab27a5b3ca8fec54eb3f35ea0b201007cbd7f364f126c4fb5258b52

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

require 'nokogiri'
require 'open-uri'
module Google
  module Scholar
    class AuthorsDocument < Document
      def valid?
        validity = !self.content.downcase.index("authors").nil?
        validity = false if !self.content.downcase.index("didn't match any").nil?
        validity
      end
      def authors_count
        self.css('.g-unit').length
      end
      def authors(force=false)
        return @authors if @authors && !force
        @authors = []
        self.css('.g-unit').each {|author| @authors << Google::Scholar::Author.new(author)}
        @authors
      end
      def last_author
        authors.last
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
google-scholar-0.0.2 lib/google/scholar/document/authors_document.rb
google-scholar-0.0.1 lib/google/scholar/document/authors_document.rb