Class: DocumentCloud::SearchResults

Inherits:
Object
  • Object
show all
Defined in:
lib/document_cloud/search_results.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ SearchResults

Returns a new instance of SearchResults.



5
6
7
8
9
10
11
12
# File 'lib/document_cloud/search_results.rb', line 5

def initialize(attrs)
  @total    = attrs[:total]
  @page     = attrs[:page]
  @per_page = attrs[:per_page]
  @query    = attrs[:q]
  
  @documents = attrs[:documents].map {|d| DocumentCloud::Document.new(d) }
end

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



3
4
5
# File 'lib/document_cloud/search_results.rb', line 3

def page
  @page
end

#per_pageObject (readonly)

Returns the value of attribute per_page.



3
4
5
# File 'lib/document_cloud/search_results.rb', line 3

def per_page
  @per_page
end

#queryObject (readonly)

Returns the value of attribute query.



3
4
5
# File 'lib/document_cloud/search_results.rb', line 3

def query
  @query
end

#totalObject (readonly)

Returns the value of attribute total.



3
4
5
# File 'lib/document_cloud/search_results.rb', line 3

def total
  @total
end

Instance Method Details

#documentsObject



14
15
16
# File 'lib/document_cloud/search_results.rb', line 14

def documents
  @documents
end