Class: DataTable
- Inherits:
-
Object
- Object
- DataTable
- Defined in:
- lib/source/Data_table.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #get_cell(row, col) ⇒ Object
-
#initialize(data) ⇒ DataTable
constructor
A new instance of DataTable.
- #num_columns ⇒ Object
- #num_rows ⇒ Object
- #to_2d_array ⇒ Object
Constructor Details
#initialize(data) ⇒ DataTable
Returns a new instance of DataTable.
5 6 7 |
# File 'lib/source/Data_table.rb', line 5 def initialize(data) self.data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/source/Data_table.rb', line 3 def data @data end |
Instance Method Details
#get_cell(row, col) ⇒ Object
9 10 11 |
# File 'lib/source/Data_table.rb', line 9 def get_cell(row,col) self.data[row][col] end |
#num_columns ⇒ Object
13 14 15 |
# File 'lib/source/Data_table.rb', line 13 def num_columns self.data[0].length end |
#num_rows ⇒ Object
17 18 19 |
# File 'lib/source/Data_table.rb', line 17 def num_rows self.data.length end |
#to_2d_array ⇒ Object
21 22 23 |
# File 'lib/source/Data_table.rb', line 21 def to_2d_array data.dup end |