Skip to content

Instantly share code, notes, and snippets.

@ohnishiakira
Created November 28, 2013 02:04
Show Gist options
  • Save ohnishiakira/7686225 to your computer and use it in GitHub Desktop.
Save ohnishiakira/7686225 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# coding: utf-8
require "csv"
rows = [
[nil, "ほげ"],
["", "ほげ"]
]
puts CSV.generate("", force_quotes:true){|csv|
rows.map{|row| csv << row}
}
puts CSV.generate(""){|csv|
rows.map{|row| csv << row}
}
puts CSV.generate("", col_sep:"\t"){|csv|
rows.map{|row| csv << row}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment