Class: GoogleSiteSearch::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/google-site-search/result.rb

Overview

A default class that parses a result element from Googles search API.

See LibXML Ruby’s Node when writing your own Result class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Result

Attributes

  • node - LibXML::XML::Node.



13
14
15
16
17
18
19
20
# File 'lib/google-site-search/result.rb', line 13

def initialize(node)
	@title = node.find_first("T").content

	# Fully qualified URL to the result.
	@link = node.find_first("UE").content

	@description = node.find_first("S").content
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/google-site-search/result.rb', line 8

def description
  @description
end

Returns the value of attribute link.



8
9
10
# File 'lib/google-site-search/result.rb', line 8

def link
  @link
end

#titleObject (readonly)

Returns the value of attribute title.



8
9
10
# File 'lib/google-site-search/result.rb', line 8

def title
  @title
end