Class: DatastaxRails::Collection
- Defined in:
- lib/datastax_rails/collection.rb
Overview
Holds a collection of DatastaxRails::Base objects.
Instance Attribute Summary collapse
-
#current_page ⇒ Fixnum
The current page of the search that produced these results (used by will_paginate).
-
#facets ⇒ Hash
The facet results (field and/or range).
-
#highlights ⇒ Object
Returns the value of attribute highlights.
-
#per_page ⇒ Fixnum
The per page value of the search that produced these results (used by will_paginate).
-
#total_entries ⇒ Fixnum
The total number of entries that match the search.
Instance Method Summary collapse
Instance Attribute Details
#current_page ⇒ Fixnum
Returns the current page of the search that produced these results (used by will_paginate).
12 |
# File 'lib/datastax_rails/collection.rb', line 12 attr_accessor :total_entries, :per_page, :current_page, :facets, :highlights |
#facets ⇒ Hash
Returns the facet results (field and/or range).
12 |
# File 'lib/datastax_rails/collection.rb', line 12 attr_accessor :total_entries, :per_page, :current_page, :facets, :highlights |
#highlights ⇒ Object
Returns the value of attribute highlights.
12 13 14 |
# File 'lib/datastax_rails/collection.rb', line 12 def highlights @highlights end |
#per_page ⇒ Fixnum
Returns the per page value of the search that produced these results (used by will_paginate).
12 |
# File 'lib/datastax_rails/collection.rb', line 12 attr_accessor :total_entries, :per_page, :current_page, :facets, :highlights |
#total_entries ⇒ Fixnum
Returns the total number of entries that match the search.
12 13 14 |
# File 'lib/datastax_rails/collection.rb', line 12 def total_entries @total_entries end |
Instance Method Details
#inspect ⇒ Object
14 15 16 |
# File 'lib/datastax_rails/collection.rb', line 14 def inspect "<DatastaxRails::Collection##{object_id} contents: #{super}>" end |
#total_pages ⇒ Object
18 19 20 21 |
# File 'lib/datastax_rails/collection.rb', line 18 def total_pages return 1 unless per_page (total_entries / per_page.to_f).ceil end |