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



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/rwd/rwd.rb', line 216

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



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

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



212
213
214
# File 'lib/rwd/rwd.rb', line 212

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