kor 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae059977b25e8edb7afeabcb45017b2d67774f48
4
- data.tar.gz: 409be5d857391cdad04ac4c7fcecd098c1e76a97
3
+ metadata.gz: bd2fdf2bb00f0d166762cc23c182273f237606f1
4
+ data.tar.gz: 6700bcd1a6abdeb9f6314fb995325bfc50eac6a9
5
5
  SHA512:
6
- metadata.gz: a0b015246741798570b1550a501712c4e7ad5af42919e11323862a6935aab1521c809f927cc14fed43b2672c065a43ee6ef5140583c6f65212aa7b579a5f2022
7
- data.tar.gz: 9c4a99ce1c643bb0af9d29917d4425da17fa22c972383a4793e5e61e8f6be7dd39b7d0d1f17d1a3ed91adb61be7c89af39716bbb7cb834ad241e7eadb533f658
6
+ metadata.gz: 6a6e55a09cede35a09fece484ad381715f7d64ddd758437e4308e4393b05c9da1866cb08c9af900e243dffc04da0598fd2f99c317d41b04935457397d8df1b20
7
+ data.tar.gz: a49f5751f123785943068bfdea8a8cc0668a311d3a1f3ee8d523e190dad2a7acf14c6a712d4b791a7d020574c0a4da7544bb58ea3ac0cb6ffe73f0274f01bf17
@@ -1,14 +1,16 @@
1
+ require 'csv'
2
+
1
3
  module Kor
2
4
  module Output
3
5
  class Csv < Base
4
6
  DELIM = ","
5
7
 
6
8
  def head(keys)
7
- io.puts keys.map{|k| "\"#{k}\""}.join(self.class::DELIM)
9
+ io.puts keys.to_csv(col_sep: self.class::DELIM)
8
10
  end
9
11
 
10
12
  def puts(values)
11
- io.puts values.map{|k| "\"#{k}\""}.join(self.class::DELIM)
13
+ io.puts values.to_csv(col_sep: self.class::DELIM)
12
14
  end
13
15
  end
14
16
  end
@@ -5,8 +5,8 @@ module KorOutputCsvTest
5
5
  def test_head(t)
6
6
  io = StringIO.new
7
7
  csv = Kor::Output::Csv.new(io)
8
- csv.head(%w(foo bar baz,qux))
9
- expect = %Q{"foo","bar","baz,qux"\n}
8
+ csv.head(["foo", "bar", "baz,qux", nil])
9
+ expect = %Q{foo,bar,"baz,qux",\n}
10
10
  if io.string != expect
11
11
  t.error("expect output #{expect} got #{io.string.inspect}")
12
12
  end
@@ -15,8 +15,8 @@ module KorOutputCsvTest
15
15
  def test_puts(t)
16
16
  io = StringIO.new
17
17
  csv = Kor::Output::Csv.new(io)
18
- csv.puts(%w(aaa bbb,ccc ddd))
19
- expect = %Q{"aaa","bbb,ccc","ddd"\n}
18
+ csv.puts([nil, "aaa", "bbb,ccc", "ddd"])
19
+ expect = %Q{,aaa,"bbb,ccc",ddd\n}
20
20
  if io.string != expect
21
21
  t.error("expect output #{expect} got #{io.string.inspect}")
22
22
  end
@@ -5,8 +5,8 @@ module KorOutputTsvTest
5
5
  def test_head(t)
6
6
  io = StringIO.new
7
7
  tsv = Kor::Output::Tsv.new(io)
8
- tsv.head(["foo", "bar", "baz\tqux"])
9
- expect = %Q{"foo"\t"bar"\t"baz\tqux"\n}
8
+ tsv.head(["foo", "bar", "baz\tqux", nil])
9
+ expect = %Q{foo\tbar\t"baz\tqux"\t\n}
10
10
  if io.string != expect
11
11
  t.error("expect output #{expect.inspect} got #{io.string.inspect}")
12
12
  end
@@ -15,8 +15,8 @@ module KorOutputTsvTest
15
15
  def test_puts(t)
16
16
  io = StringIO.new
17
17
  tsv = Kor::Output::Tsv.new(io)
18
- tsv.puts(["aaa", "bbb\tccc", "ddd"])
19
- expect = %Q{"aaa"\t"bbb\tccc"\t"ddd"\n}
18
+ tsv.puts([nil, "aaa", "bbb\tccc", "ddd"])
19
+ expect = %Q{\taaa\t"bbb\tccc"\tddd\n}
20
20
  if io.string != expect
21
21
  t.error("expect output #{expect.inspect} got #{io.string.inspect}")
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module Kor
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-05 00:00:00.000000000 Z
11
+ date: 2015-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler