Class: DocumentCloud::SearchResults
- Inherits:
-
Object
- Object
- DocumentCloud::SearchResults
- Defined in:
- lib/document_cloud/search_results.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #documents ⇒ Object
-
#initialize(attrs) ⇒ SearchResults
constructor
A new instance of SearchResults.
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
#page ⇒ Object (readonly)
Returns the value of attribute page.
3 4 5 |
# File 'lib/document_cloud/search_results.rb', line 3 def page @page end |
#per_page ⇒ Object (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 |
#query ⇒ Object (readonly)
Returns the value of attribute query.
3 4 5 |
# File 'lib/document_cloud/search_results.rb', line 3 def query @query end |
#total ⇒ Object (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
#documents ⇒ Object
14 15 16 |
# File 'lib/document_cloud/search_results.rb', line 14 def documents @documents end |