Class: DatastaxRails::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/datastax_rails/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_pageFixnum

Returns the current page of the search that produced these results (used by will_paginate).

Returns:

  • (Fixnum)

    the current page of the search that produced these results (used by will_paginate)



11
# File 'lib/datastax_rails/collection.rb', line 11

attr_accessor :total_entries, :per_page, :current_page, :facets, :highlights

#facetsHash

Returns the facet results (field and/or range).

Returns:

  • (Hash)

    the facet results (field and/or range)



11
# File 'lib/datastax_rails/collection.rb', line 11

attr_accessor :total_entries, :per_page, :current_page, :facets, :highlights

#highlightsObject

Returns the value of attribute highlights.



11
12
13
# File 'lib/datastax_rails/collection.rb', line 11

def highlights
  @highlights
end

#per_pageFixnum

Returns the per page value of the search that produced these results (used by will_paginate).

Returns:

  • (Fixnum)

    the per page value of the search that produced these results (used by will_paginate)



11
# File 'lib/datastax_rails/collection.rb', line 11

attr_accessor :total_entries, :per_page, :current_page, :facets, :highlights

#total_entriesFixnum

Returns the total number of entries that match the search.

Returns:

  • (Fixnum)

    the total number of entries that match the search



11
12
13
# File 'lib/datastax_rails/collection.rb', line 11

def total_entries
  @total_entries
end

Instance Method Details

#inspectObject



13
14
15
# File 'lib/datastax_rails/collection.rb', line 13

def inspect
  "<DatastaxRails::Collection##{object_id} contents: #{super} last_column_name: #{last_column_name.inspect}>"
end

#total_pagesObject



17
18
19
20
# File 'lib/datastax_rails/collection.rb', line 17

def total_pages
  return 1 unless per_page
  (total_entries / per_page.to_f).ceil
end