Class: Table
Overview
this class represents a table, it’s just a two-dimensional array, [[a,x,f],]
Instance Attribute Summary collapse
-
#objects ⇒ Object
Returns the value of attribute objects.
-
#types ⇒ Object
Returns the value of attribute types.
Instance Method Summary collapse
- #each ⇒ Object (also: #each_row)
-
#initialize ⇒ Table
constructor
A new instance of Table.
- #my_json ⇒ Object
Constructor Details
#initialize ⇒ Table
Returns a new instance of Table.
192 193 194 195 |
# File 'lib/annlat/AnnLat.rb', line 192 def initialize @objects=[] @types=[] end |
Instance Attribute Details
#objects ⇒ Object
Returns the value of attribute objects.
183 184 185 |
# File 'lib/annlat/AnnLat.rb', line 183 def objects @objects end |
#types ⇒ Object
Returns the value of attribute types.
183 184 185 |
# File 'lib/annlat/AnnLat.rb', line 183 def types @types end |
Instance Method Details
#each ⇒ Object Also known as: each_row
197 198 199 |
# File 'lib/annlat/AnnLat.rb', line 197 def each @objects.each {|row| yield(row)} end |
#my_json ⇒ Object
185 186 187 188 189 190 |
# File 'lib/annlat/AnnLat.rb', line 185 def my_json t=Table.new t.objects = self.objects.map {|row| row.map {|cell| cell.my_json }} t.types=self.types t end |