Class: DataTable

Inherits:
Object
  • Object
show all
Defined in:
lib/source/Data_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject

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_columnsObject



13
14
15
# File 'lib/source/Data_table.rb', line 13

def num_columns
	self.data[0].length
end

#num_rowsObject



17
18
19
# File 'lib/source/Data_table.rb', line 17

def num_rows
	self.data.length
end

#to_2d_arrayObject



21
22
23
# File 'lib/source/Data_table.rb', line 21

def to_2d_array
	data.dup
end