Class: Table

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/annlat/AnnLat.rb

Overview

this class represents a table, it’s just a two-dimensional array, [[a,x,f],]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTable

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

#objectsObject

Returns the value of attribute objects.



183
184
185
# File 'lib/annlat/AnnLat.rb', line 183

def objects
  @objects
end

#typesObject

Returns the value of attribute types.



183
184
185
# File 'lib/annlat/AnnLat.rb', line 183

def types
  @types
end

Instance Method Details

#eachObject Also known as: each_row



197
198
199
# File 'lib/annlat/AnnLat.rb', line 197

def each
  @objects.each {|row| yield(row)}
end

#my_jsonObject



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