Class: EVTable

Inherits:
Object show all
Defined in:
lib/rwd/rwd.rb

Instance Method Summary collapse

Instance Method Details

#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

#rwd_metadataObject



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/rwd/rwd.rb', line 250

def 
  res	= []

  res << "<table>"
  res << "<row>"
  res << "  <empty/>"
  res << "  <text name='header_new' value=''/>"
  res << "</row>"
  @headers.each_index do |n|
    res << "<row>"
    res << "  <text name='header_#{n}_old' value='#{@headers[n]}'/>"
    res << "  <text name='header_#{n}_new' value=''/>"
    res << "</row>"
  end
  res << "</table>"

  return res.join("\n")
end

#rwd_table(field = nil, joinwith = @sep) ⇒ Object



230
231
232
# File 'lib/rwd/rwd.rb', line 230

def rwd_table(field=nil, joinwith=@sep)
  super(field, joinwith, @headers)
end