Class: DatastaxRails::Collection

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

Overview

Holds a collection of DatastaxRails::Base objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_pageFixnum


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

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

#facetsHash


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

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

#highlightsObject

Returns the value of attribute highlights


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

def highlights
  @highlights
end

#per_pageFixnum


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

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

#total_entriesFixnum


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

def total_entries
  @total_entries
end

Instance Method Details

#inspectObject


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

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

#total_pagesObject


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