Sha256: b7fda164b9c9ff5fdd13098cbe1756e98cbabb617922b40a6b739d69f65a439a

Contents?: true

Size: 844 Bytes

Versions: 2

Compression:

Stored size: 844 Bytes

Contents

module Google
  module Scholar
    class Document
      attr_reader :document
      def initialize(nokogiri_document)
        @document = nokogiri_document
      end
      def method_missing(meth, *args, &block)
        if(@document.respond_to?(meth))
          return @document.send(meth,*args,&block)
        else
          super
        end
      end
      def has_next_page?
        @document.css('.cit-dgb .cit-dark-link').each do |link|
          return true if link.content.include?("Next")
        end
        return false
      end
      def next_page_url
        return nil unless self.has_next_page?
        @document.css('.cit-dgb .cit-dark-link').each do |link|
          if(link.content.include?("Next"))
            return "#{Google::Scholar.google_url}#{link.attr("href")}"
          end
        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/document.rb
google-scholar-0.0.1 lib/google/scholar/document.rb