Class: ResultItem
- Inherits:
-
Object
- Object
- ResultItem
- Defined in:
- lib/site_search/result_item.rb
Instance Attribute Summary collapse
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(item) ⇒ ResultItem
constructor
Creates attributes that can easily be accessed from the view.
Constructor Details
#initialize(item) ⇒ ResultItem
Creates attributes that can easily be accessed from the view
5 6 7 8 9 10 |
# File 'lib/site_search/result_item.rb', line 5 def initialize(item) @url = item['link'] @text = item['snippet'] @title = item['displayLink'] @html = item['htmlSnippet'] end |
Instance Attribute Details
#html ⇒ Object (readonly)
Returns the value of attribute html.
2 3 4 |
# File 'lib/site_search/result_item.rb', line 2 def html @html end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'lib/site_search/result_item.rb', line 2 def text @text end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
2 3 4 |
# File 'lib/site_search/result_item.rb', line 2 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
2 3 4 |
# File 'lib/site_search/result_item.rb', line 2 def url @url end |