Class: ProMotion::CollectionData
- Inherits:
-
Object
- Object
- ProMotion::CollectionData
- Includes:
- CollectionDataBuilder, Table::Utils
- Defined in:
- lib/ProMotion/collection/data/collection_data.rb
Instance Attribute Summary collapse
-
#collection_view ⇒ Object
Returns the value of attribute collection_view.
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #cell(params = {}) ⇒ Object
-
#initialize(data, collection_view) ⇒ CollectionData
constructor
A new instance of CollectionData.
- #section(index) ⇒ Object
- #section_length(index) ⇒ Object
- #sections ⇒ Object
Methods included from CollectionDataBuilder
Methods included from Table::Utils
#array_all_members_of?, #index_path_to_section_index
Constructor Details
#initialize(data, collection_view) ⇒ CollectionData
Returns a new instance of CollectionData.
8 9 10 11 |
# File 'lib/ProMotion/collection/data/collection_data.rb', line 8 def initialize(data, collection_view) self.data = data self.collection_view = WeakRef.new(collection_view) end |
Instance Attribute Details
#collection_view ⇒ Object
Returns the value of attribute collection_view.
6 7 8 |
# File 'lib/ProMotion/collection/data/collection_data.rb', line 6 def collection_view @collection_view end |
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/ProMotion/collection/data/collection_data.rb', line 6 def data @data end |
Instance Method Details
#cell(params = {}) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/ProMotion/collection/data/collection_data.rb', line 25 def cell(params={}) params = index_path_to_section_index(params) section = self.data[params[:section]] c = section.at(params[:index].to_i) set_data_cell_defaults(c) end |
#section(index) ⇒ Object
13 14 15 |
# File 'lib/ProMotion/collection/data/collection_data.rb', line 13 def section(index) sections.at(index) || [] end |
#section_length(index) ⇒ Object
21 22 23 |
# File 'lib/ProMotion/collection/data/collection_data.rb', line 21 def section_length(index) section(index).length end |
#sections ⇒ Object
17 18 19 |
# File 'lib/ProMotion/collection/data/collection_data.rb', line 17 def sections self.data end |