Class: HotCocoa::TableDataSource

Inherits:
Object
  • Object
show all
Defined in:
lib/hotcocoa/data_sources/table_data_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ TableDataSource

Returns a new instance of TableDataSource.



5
6
7
# File 'lib/hotcocoa/data_sources/table_data_source.rb', line 5

def initialize data
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/hotcocoa/data_sources/table_data_source.rb', line 3

def data
  @data
end

Instance Method Details

#numberOfRowsInTableView(tableView) ⇒ Object



9
10
11
# File 'lib/hotcocoa/data_sources/table_data_source.rb', line 9

def numberOfRowsInTableView tableView
  data.length
end

#tableView(view, objectValueForTableColumn: column, row: i) ⇒ Object



13
14
15
# File 'lib/hotcocoa/data_sources/table_data_source.rb', line 13

def tableView view, objectValueForTableColumn: column, row: i
  data[i][column.identifier.intern]
end