Method: EVTable#rwd_form

Defined in:
lib/rwd/rwd.rb

#rwd_form(prefix = "", key = nil, twoparts = false) ⇒ Object



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/rwd/rwd.rb', line 234

def rwd_form(prefix="", key=nil, twoparts=false)
  values	= self[key]	if not key.nil?
  values	= []		if values.nil?
  options	= {}

  if File.file?(oldlocation("constraints.tsv"))
    table	= File.basename(@file).gsub(/\.tsv$/, "")

    TSVFile.new(oldlocation("constraints.tsv")).subset(["Table", "Constraint"], [table, "key"], ["Column", "Value"]).values.each do |column, table2|
      options[column]	= TSVFile.new(oldlocation("#{table2}.tsv")).keys.collect{|a| a.join("\t")}
    end
  end

  @headers.rwd_form(prefix, values, twoparts ? @key : 0, options)
end