lib/omf_oml/network.rb in omf_oml-1.1.8 vs lib/omf_oml/network.rb in omf_oml-1.1.9
- old
+ new
@@ -232,14 +232,17 @@
#
# aspect - Either :nodes or :links
#
def to_table(aspect, table_opts = {})
aspect = aspect.to_sym
+ table_opts[:supress_index] = true
case aspect
when :nodes
+ #puts "TABLE SCHEME 1 >>>> #{@node_schema}"
table = OmlTable.create @name + '/nodes', @node_schema, table_opts
- #puts "TABLE SCHEME >>>> #{table.schema}"
+ #puts "TABLE SCHEME 2 >>>> #{@node_schema} - #{table.schema}"
+ #table.add_rows(@nodes)
table.add_rows(@nodes.map do |id, n|
@node_schema.hash_to_row(n.attributes)
end)
on_update "__to_tables_nodes_#{table.object_id}" do |a|
nodes = a.map do |e|
@@ -248,20 +251,11 @@
table.add_rows(nodes) unless nodes.empty?
end
when :links
table = OmlTable.create @name + '/links', @link_schema, table_opts
- # @links.each do |id, l|
- # table.add_row @link_schema.hash_to_row(l.attributes)
- # end
table.add_rows(@links.map do |id, n|
- # puts @link_schema.hash_to_row(n.attributes).inspect
- # puts table.schema
- # table.add_row @link_schema.hash_to_row(n.attributes)
- # puts table.rows.inspect
- # exit
-
- @link_schema.hash_to_row(n.attributes)
+ @link_schema.hash_to_row(n.attributes)
end)
#puts table.rows.inspect
on_update "__to_tables_links_#{table.object_id}" do |a|
links = a.map do |e|
e.kind_of?(NetworkLink) ? @link_schema.hash_to_row(e.attributes) : nil