tsv 0.0.2 → 0.0.3

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: b69a0b82ebc54fb3e050ce023c611120c8b90927
4
- data.tar.gz: f3ca28bf29303d12b4d95ce611fccd6d4893c184
3
+ metadata.gz: dccfc4465a2459edbb3847afe9a97085a30c246a
4
+ data.tar.gz: 8f6c86869945c3bae1a9653b91fc7c7b5fdfa0f0
5
5
  SHA512:
6
- metadata.gz: 1963c89c34987e9767cd5cc5bfe8d482018c5d0468b5b74866c377bd037473835fbdc6767b11f14362a0b8741e0e44b02a783a0e33ee57b22bc3c84ac1d5e87a
7
- data.tar.gz: 42d99362bca82d106e8715f949cadd56e3868edbfd0380e0642ed6c6febcbc77e1077d7ed2fabd0f1118d3a7516d8a076c4d29d4964d8bfe682459734ae5fee1
6
+ metadata.gz: 0151a2a89fc5141711095bdc0f2f0fcb03de963947802cee913eeca5a19acfa18574c38978fa68f3012603399074bf68b13d079ee78979609f0e26fa3033b5ab
7
+ data.tar.gz: f6f18e7654c47a5a16721c4885e363beb2de78709806211a87da9b7684f86ddeff014c16df0ec3df8025463bce25df5606cfc4a10426c2d1831963c1fee10a9c
@@ -0,0 +1,24 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ ## [Unreleased][unreleased]
5
+
6
+ ## [0.0.3] - 2014-12-26
7
+ ### Fixed
8
+ - Fixed case with empty column contents in TSV
9
+
10
+ ### Added
11
+ - First version of CHANGELOG.md
12
+
13
+ ## [0.0.2] - 2014-08-13
14
+ ### Changed
15
+ - Internal refactorings
16
+
17
+ ### Added
18
+ - Testing built gem integrity via CI
19
+
20
+ Changelog format taken from [keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog)
21
+
22
+ [unreleased]: https://github.com/mimimi/ruby-tsv/compare/v0.0.3...master
23
+ [0.0.3]: https://github.com/mimimi/ruby-tsv/compare/v0.0.2...v0.0.3
24
+ [0.0.2]: https://github.com/mimimi/ruby-tsv/compare/v0.0.1...v0.0.2
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Tsv
2
2
  [![Build Status](https://travis-ci.org/mimimi/ruby-tsv.svg?branch=master)](https://travis-ci.org/mimimi/ruby-tsv)
3
+ [![Code Climate](https://codeclimate.com/github/mimimi/ruby-tsv/badges/gpa.svg)](https://codeclimate.com/github/mimimi/ruby-tsv)
4
+ [![Test Coverage](https://codeclimate.com/github/mimimi/ruby-tsv/badges/coverage.svg)](https://codeclimate.com/github/mimimi/ruby-tsv)
3
5
 
4
6
  A simple TSV parser, developed with aim of parsing a ~200Gb TSV dump. As such, no mode of operation, but enumerable is considered sane. Feel free to use `#to_a` on your supercomputer :)
5
7
 
@@ -47,7 +47,7 @@ module TSV
47
47
  protected
48
48
 
49
49
  def generate_row_from(str)
50
- str.to_s.chomp.split("\t")
50
+ str.to_s.chomp.split("\t", -1)
51
51
  end
52
52
 
53
53
  def generate_default_header_from(example_line)
@@ -28,7 +28,7 @@ module TSV
28
28
  @data = data
29
29
  @header = header
30
30
 
31
- raise InputError if @data.length != @header.length
31
+ raise InputError.new("Row has #{@data.length} columns, but #{@header.length} columns expected") if @data.length != @header.length
32
32
  end
33
33
 
34
34
  def with_header
@@ -1,3 +1,3 @@
1
1
  module TSV
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,3 @@
1
+ first second third
2
+ 0 1 2
3
+ one
@@ -47,6 +47,20 @@ describe TSV do
47
47
  end
48
48
  end
49
49
  end
50
+
51
+ context "when file includes empty trailing fields" do
52
+ let(:filename) { 'empty-trailing.tsv' }
53
+
54
+ context "when no block is passed" do
55
+ let(:parameters) { Hash.new }
56
+
57
+ it "returns its content as array of hashes" do
58
+ headers = %w{first second third}
59
+ expect(subject).to eq [ TSV::Row.new( ['0', '1', '2'], headers ),
60
+ TSV::Row.new( ['one', '', ''], headers ) ]
61
+ end
62
+ end
63
+ end
50
64
  end
51
65
 
52
66
  describe "reading from string" do
@@ -92,4 +106,4 @@ describe TSV do
92
106
  end
93
107
  end
94
108
  end
95
- end
109
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tsv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmytro Soltys
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-13 00:00:00.000000000 Z
12
+ date: 2014-12-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Streamed TSV parser
15
15
  email:
@@ -19,9 +19,10 @@ executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
- - .gitignore
23
- - .rspec
24
- - .travis.yml
22
+ - ".gitignore"
23
+ - ".rspec"
24
+ - ".travis.yml"
25
+ - CHANGELOG.md
25
26
  - Gemfile
26
27
  - LICENSE.txt
27
28
  - README.md
@@ -31,6 +32,7 @@ files:
31
32
  - lib/tsv/row.rb
32
33
  - lib/tsv/version.rb
33
34
  - spec/fixtures/broken.tsv
35
+ - spec/fixtures/empty-trailing.tsv
34
36
  - spec/fixtures/empty.tsv
35
37
  - spec/fixtures/example.tsv
36
38
  - spec/lib/tsv/file_cyclist_spec.rb
@@ -51,23 +53,24 @@ require_paths:
51
53
  - lib
52
54
  required_ruby_version: !ruby/object:Gem::Requirement
53
55
  requirements:
54
- - - '>='
56
+ - - ">="
55
57
  - !ruby/object:Gem::Version
56
58
  version: '0'
57
59
  required_rubygems_version: !ruby/object:Gem::Requirement
58
60
  requirements:
59
- - - '>='
61
+ - - ">="
60
62
  - !ruby/object:Gem::Version
61
63
  version: '0'
62
64
  requirements: []
63
65
  rubyforge_project:
64
- rubygems_version: 2.0.6
66
+ rubygems_version: 2.2.2
65
67
  signing_key:
66
68
  specification_version: 4
67
69
  summary: Provides a simple parser for standard compliant and not so (missing header
68
70
  line) TSV files
69
71
  test_files:
70
72
  - spec/fixtures/broken.tsv
73
+ - spec/fixtures/empty-trailing.tsv
71
74
  - spec/fixtures/empty.tsv
72
75
  - spec/fixtures/example.tsv
73
76
  - spec/lib/tsv/file_cyclist_spec.rb