Class: Gini::Api::DocumentSet
- Inherits:
-
Object
- Object
- Gini::Api::DocumentSet
- Includes:
- Enumerable
- Defined in:
- lib/gini-api/documentset.rb
Overview
Set of documents resulting from search or list query
Instance Attribute Summary collapse
-
#documents ⇒ Object
readonly
Returns the value of attribute documents.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#each ⇒ Object
Allow iteration on documents by yielding documents Required by Enumerable mixin.
-
#initialize(api, data) ⇒ DocumentSet
constructor
Instantiate a new Gini::Api::Document object from URL.
Constructor Details
#initialize(api, data) ⇒ DocumentSet
Instantiate a new Gini::Api::Document object from URL
20 21 22 23 24 25 |
# File 'lib/gini-api/documentset.rb', line 20 def initialize(api, data) @total = data[:totalCount] @documents = data[:documents].map do |doc| Gini::Api::Document.new(api, doc[:_links][:document], doc) end end |
Instance Attribute Details
#documents ⇒ Object (readonly)
Returns the value of attribute documents.
8 9 10 |
# File 'lib/gini-api/documentset.rb', line 8 def documents @documents end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
8 9 10 |
# File 'lib/gini-api/documentset.rb', line 8 def offset @offset end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
8 9 10 |
# File 'lib/gini-api/documentset.rb', line 8 def total @total end |
Instance Method Details
#each ⇒ Object
Allow iteration on documents by yielding documents Required by Enumerable mixin
30 31 32 |
# File 'lib/gini-api/documentset.rb', line 30 def each @documents.each { |d| yield(d) } end |