cosvon 0.0.0.2 → 0.0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfe2240d43b01ac288d579f88b776459e29d7f60
4
- data.tar.gz: 700563855505d0e54d4ba235713b2706450e7e2b
3
+ metadata.gz: 1ec2eded8df132928a91123bd716c38ac751e3eb
4
+ data.tar.gz: 2cd209470911f510ca04a3f5e7449e2f1d458b59
5
5
  SHA512:
6
- metadata.gz: ac440d9c893f727f677bcd6588940ff4c5f0aec636e43d31d8431749e23faf459f55bde91a73f2aaae5c6bdb4d731e978ff540bebebe62a1f0afea67c7e8905f
7
- data.tar.gz: 9e75777edb5a7546fb88356a4205e2f9993c5647eca200617578e3a511e7e62edb312b6a74af075570e6a7e59b6de09fd66c7a842bd26a3afc8ab127deedd239
6
+ metadata.gz: 6288ad48208cf41d91f8c88a7ac49993c4be3bc1d5f2bd210af9a9d30c6a16026f0fd48a9bc14e94d4761c7592e715e47d3d6468b7c951baee126578d12c837a
7
+ data.tar.gz: 4949e1dfb96784a6e7387139dd2113763cc9dae4f2293805e9df7629ce33881025c910f6cfe125b023848205223a4e0b3ef561edbb8cad4dec563b3bb32f59a1
data/.travis.yml CHANGED
@@ -1,7 +1,4 @@
1
1
  language: ruby
2
- before_install:
3
- - gem update --system 2.1.11
4
- - gem --version
5
2
  rvm:
6
3
  - 1.8.7
7
4
  - ree
@@ -9,17 +6,22 @@ rvm:
9
6
  - 1.9.3
10
7
  - 2.0.0
11
8
  - 2.1.0
12
- - 2.1.1
13
- - 2.1.2
9
+ - 2.1.7
10
+ - 2.2.0
11
+ - 2.2.3
14
12
  - ruby-head
15
13
  - jruby-18mode
16
14
  - jruby-19mode
17
15
  - jruby-20mode
18
16
  - jruby-21mode
19
17
  - jruby-head
20
- - rbx-2.1.1
21
- - rbx-2.2.3
18
+ - rbx-2
22
19
  matrix:
23
20
  allow_failures:
24
21
  - rvm: ruby-head
25
22
  - rvm: jruby-head
23
+ - rvm: jruby-18mode
24
+ - rvm: jruby-19mode
25
+ - rvm: jruby-20mode
26
+ - rvm: jruby-21mode
27
+ - rvm: rbx-2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # ChangeLog
2
2
 
3
+ # 0.0.0.3 (20160519)
4
+ Line-break can be either LF/CR/CRLF (must be the same within a file).
5
+
3
6
  # 0.0.0.2 (20150621)
4
7
  Some CSVs are broken due to SJIS dame-moji.
5
8
  I have added a workaround into CoSVON.csv().
data/lib/cosvon.rb CHANGED
@@ -8,7 +8,7 @@ class CoSVON
8
8
  HSALSKCAB='―ソЫ噂浬欺圭構蚕十申曾箪貼能表暴予禄兔喀媾彌拿杤歃濬畚秉綵臀藹觸軆鐔饅鷭偆砡'
9
9
 
10
10
  # VERSION string
11
- VERSION='0.0.0.2'
11
+ VERSION='0.0.0.3'
12
12
 
13
13
  # parses csv string into 2D array. quoted commas/LFs and escaped quotations are supported.
14
14
  def self.csv(s,__opt=Hash.new)
@@ -19,9 +19,10 @@ class CoSVON
19
19
  quote=false
20
20
  backslash=0
21
21
  cur=''
22
- (s+(s.end_with?("\n") ? "" : "\n")).each_char{|c|
23
- if c=="\r" #ignore CR
24
- elsif c==opt[:quote_char]
22
+ linebreak=nil
23
+ s.each_char{|c|
24
+ #if c=="\r" #ignore CR
25
+ if c==opt[:quote_char]
25
26
  if !quoted #start of quote
26
27
  quoted=true
27
28
  elsif !quote #end of quote? Let's determine using next char
@@ -45,11 +46,14 @@ class CoSVON
45
46
  quoted=false
46
47
  end
47
48
  end
48
- if c=="\n"&&!quoted
49
- line<<cur
50
- cur=''
51
- csv<<line
52
- line=[]
49
+ if (c=="\n"||c=="\r")&&!quoted
50
+ if !linebreak||linebreak==c
51
+ line<<cur
52
+ cur=''
53
+ csv<<line
54
+ line=[]
55
+ linebreak=c
56
+ end
53
57
  elsif c==opt[:col_sep]&&!quoted
54
58
  line<<cur
55
59
  cur=''
@@ -63,6 +67,8 @@ class CoSVON
63
67
  end
64
68
  end
65
69
  }
70
+ line<<cur if !cur.empty?
71
+ csv<<line if !line.empty?
66
72
  csv
67
73
  end
68
74
 
data/spec/cosvon_spec.rb CHANGED
@@ -1,3 +1,4 @@
1
+ #coding:utf-8
1
2
  SPEC_DIR=File.expand_path(File.dirname(__FILE__))
2
3
  require SPEC_DIR+'/spec_helper'
3
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosvon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.2
4
+ version: 0.0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - cielavenir
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-20 00:00:00.000000000 Z
11
+ date: 2016-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.0.14
95
+ rubygems_version: 2.0.14.1
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Comma Separated Value Object Notation