Class: GoogleSiteSearch::Result
- Inherits:
-
Object
- Object
- GoogleSiteSearch::Result
- 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
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(node) ⇒ Result
constructor
Attributes.
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
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/google-site-search/result.rb', line 8 def description @description end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
8 9 10 |
# File 'lib/google-site-search/result.rb', line 8 def link @link end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/google-site-search/result.rb', line 8 def title @title end |