class ReVIEW::Retrovert::Utils

Public Class Methods

GenerateTsv(c) click to toggle source
# File lib/review/retrovert/utils.rb, line 28
def GenerateTsv(c)
  CSV.generate_line(Utils::NormalizeCSVArray(c), col_sep: "\t")
end
NormalizeCSVArray(ar) click to toggle source
# File lib/review/retrovert/utils.rb, line 19
def NormalizeCSVArray(ar)
  ar&.each do |c|
    c.gsub!(/\A"|"\z/, '')
    c.gsub!(/^\s*/, '')
    c.gsub!(/[\r\n]/, '')
  end
  ar
end
Tsv2Csv(infile, outfile) click to toggle source

tsv to csv

# File lib/review/retrovert/utils.rb, line 9
def Tsv2Csv(infile, outfile)
  File.open(infile, 'r') do |file|
    CSV.open(outfile, 'w') do |csv|
      file.each_line do |line|
        csv << line.chomp.split(/\t+/)
      end
    end
  end
end