# append data ticker_log_exists = File.exists? ARGV[1] ticker_log = File.open( ARGV[1], 'a' ) header = " DATE \t TIME \t" row = '' stocks.each do |stock| header << (stock[0].center(12)) if stock[0] == "NCC" header << " TIME" end header << "\t" row << ('%12.2f' % stock[1] ) row << "\t" if stock[0] == "NCC" row << ( current_time.strftime('%H:%M:%S') ) row << "\t" end header << "\t TIME" ticker_log.puts header unless ticker_log_exists current_time = Time.now ticker_log.puts "#{ current_time.strftime( '%m/%d/%Y' ) }\t#{ current_time.strftime( '%H:%M:%S' ) }\t#{ row }\t#{ current_time.strftime( '%H:%M:%S' ) }"