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 +4 -4
- data/lib/kor/output/csv.rb +4 -2
- data/lib/kor/output/csv_test.rb +4 -4
- data/lib/kor/output/tsv_test.rb +4 -4
- data/lib/kor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd2fdf2bb00f0d166762cc23c182273f237606f1
|
4
|
+
data.tar.gz: 6700bcd1a6abdeb9f6314fb995325bfc50eac6a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a6e55a09cede35a09fece484ad381715f7d64ddd758437e4308e4393b05c9da1866cb08c9af900e243dffc04da0598fd2f99c317d41b04935457397d8df1b20
|
7
|
+
data.tar.gz: a49f5751f123785943068bfdea8a8cc0668a311d3a1f3ee8d523e190dad2a7acf14c6a712d4b791a7d020574c0a4da7544bb58ea3ac0cb6ffe73f0274f01bf17
|
data/lib/kor/output/csv.rb
CHANGED
@@ -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.
|
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.
|
13
|
+
io.puts values.to_csv(col_sep: self.class::DELIM)
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
data/lib/kor/output/csv_test.rb
CHANGED
@@ -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(
|
9
|
-
expect = %Q{
|
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(
|
19
|
-
expect = %Q{
|
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
|
data/lib/kor/output/tsv_test.rb
CHANGED
@@ -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{
|
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{
|
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
|
data/lib/kor/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|