Skip to content

Instantly share code, notes, and snippets.

@gongo
Created June 24, 2019 02:30
Show Gist options
  • Select an option

  • Save gongo/cb8f63fa258f513acaa93ff9be6047fb to your computer and use it in GitHub Desktop.

Select an option

Save gongo/cb8f63fa258f513acaa93ff9be6047fb to your computer and use it in GitHub Desktop.

Revisions

  1. gongo created this gist Jun 24, 2019.
    19 changes: 19 additions & 0 deletions csv.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    row1 = CSV::Row.new(['a', 'b'], [1, 2])
    row2 = CSV::Row.new(['a', 'c'], [4, 12])
    table = CSV::Table.new([row1, row2])

    table.to_s

    #
    # expected:
    #
    # a,b,c
    # 1,2,
    # 4,,12
    #
    # actual:
    #
    # a,b
    # 1,2
    # 4,12
    #