class GScraper::Search::Result

Attributes

cached_url[R]

URL of the cached result page

rank[R]

Rank of the result page

similar_url[R]

URL of the similar results Query

summary[R]

Summary from the result page

title[R]

Title of the result page

url[R]

URL of the result page

Public Class Methods

new(rank,title,url,summary,cached_url=nil,similar_url=nil) click to toggle source

Creates a new {Result} object.

@param [Integer] rank

The rank of the result.

@param [String] title

The title of the result.

@param [String] summary

The summary of the result.

@param [URI::HTTP] cached_url

The Cached URL for the result.

@param [URI::HTTP] similar_url

The Similar Query URL for the result.
# File lib/gscraper/search/result.rb, line 64
def initialize(rank,title,url,summary,cached_url=nil,similar_url=nil)
  @agent = GScraper.web_agent

  @rank        = rank
  @title       = title
  @url         = url
  @summary     = summary
  @cached_url  = cached_url
  @similar_url = similar_url
end

Public Instance Methods

cached_page() click to toggle source

Fetches the Cached Page of the result.

@return [Mechanize::Page]

The Cached Page for the result.
# File lib/gscraper/search/result.rb, line 91
def cached_page
  @agent.get(@cached_url) if @cached_url
end
page() click to toggle source

Fetches the page of the result.

@return [Mechanize::Page]

The page the result represents.
# File lib/gscraper/search/result.rb, line 81
def page
  @agent.get(@url)
end
to_s() click to toggle source

The result’s title.

@return [String]

The title of the result.
# File lib/gscraper/search/result.rb, line 101
def to_s
  @title.to_s
end