Class: ResultItem

Inherits:
Object
  • Object
show all
Defined in:
lib/site_search/result_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#htmlObject (readonly)

Returns the value of attribute html.



2
3
4
# File 'lib/site_search/result_item.rb', line 2

def html
  @html
end

#textObject (readonly)

Returns the value of attribute text.



2
3
4
# File 'lib/site_search/result_item.rb', line 2

def text
  @text
end

#titleObject (readonly)

Returns the value of attribute title.



2
3
4
# File 'lib/site_search/result_item.rb', line 2

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



2
3
4
# File 'lib/site_search/result_item.rb', line 2

def url
  @url
end