typedcsv 0.1.1 → 1.0.0

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: 315765b481130f95049fe7549a29fc3e7722fd20
4
- data.tar.gz: 070a5e9194663ba62113a2a7a87e6976fd2f86df
3
+ metadata.gz: da6be8a2ddd7600570ea8ebb99192933440e8b54
4
+ data.tar.gz: 29d852057d2dc2c2d3d4bf2b52e9b82351f7748f
5
5
  SHA512:
6
- metadata.gz: ce70f197882f1103c71c108f9e97722712ced83c1f82365cd9a4b154f6a8bb032268ff822ec3ada4ec1c39f076b6b46b6388a45721bfded88bdd6dbda8468ea2
7
- data.tar.gz: '0280d2e3c7137c80dce8cf30e2c0b680e9f5bd1330575254e35ca942cdace950dc5dca7d0c1a3c46582131a1b179a00736cff9908df3bf934f8a7bbf2f2aa3ce'
6
+ metadata.gz: fd1886238aad66edeb4def0fef211f963c720dafa7e2ede06114808f311b2890dbb056ea74f21479af491e9263611f140a005c81512245288c7fca4da512d68f
7
+ data.tar.gz: 3ad641d3d9677a16f19a1a3b070e51c29ab9f95232913368c6f89584f4d5aa74c24556a50f1216320105ad470d92d8dd2eb57c1040f280a4c8cea38339f64b1e
data/CHANGELOG CHANGED
@@ -11,3 +11,9 @@ Enhancements
11
11
  Bug fixes
12
12
 
13
13
  * Handles null (empty string) across types
14
+
15
+ 1.0.0 / 2017-09-06
16
+
17
+ Breaking changes
18
+
19
+ * list types are internally comma-separated, principle of least surprise
data/README.md CHANGED
@@ -4,14 +4,14 @@ Here's your standard untyped CSV:
4
4
 
5
5
  ```
6
6
  name,income,created_at,tags,great
7
- Seamus,12301.2,2012-02-21,red;blue,true
7
+ Seamus,12301.2,2012-02-21,"red,blue",true
8
8
  ```
9
9
 
10
- Now, you and I know that `12301.2` is a number and `2012-02-21` is a date and `red;blue` is a list... so let's just write that into the headers:
10
+ Now, you and I know that `12301.2` is a number and `2012-02-21` is a date and `"red,blue"` is a list... so let's just write that into the headers:
11
11
 
12
12
  ```
13
13
  name,income:number,created_at:date,tags:list,great:boolean
14
- Seamus,12301.2,2012-02-21,red;blue,true
14
+ Seamus,12301.2,2012-02-21,"red,blue",true
15
15
  ```
16
16
 
17
17
  Now let's parse it:
@@ -31,7 +31,7 @@ This gem provides `Typedcsv.foreach()`, which takes exactly the same arguments a
31
31
 
32
32
  * text (default)
33
33
  * number
34
- * list (must be semicolon-separated)
34
+ * list (must be comma-separated and therefore quoted)
35
35
  * date (must be ISO8601)
36
36
  * time (must be ISO8601)
37
37
  * boolean (recognizes "true" or "false")
@@ -28,7 +28,7 @@ else
28
28
  rand(2**16) + rand(),
29
29
  Faker::Date.backward(900),
30
30
  Faker::Address.zip_code,
31
- rand(5).times.map { Faker::TwinPeaks.location }.to_csv(col_sep: ';').chomp,
31
+ rand(5).times.map { Faker::TwinPeaks.location }.to_csv.chomp,
32
32
  SecureRandom.uuid,
33
33
  Faker::TwinPeaks.quote
34
34
  ].to_csv
@@ -90,7 +90,7 @@ class Typedcsv
90
90
  false
91
91
  end
92
92
  when 'list'
93
- CSV.parse_line(v, col_sep: ';')
93
+ CSV.parse_line(v)
94
94
  when 'date'
95
95
  Time.parse(v).to_date
96
96
  when 'time'
@@ -1,3 +1,3 @@
1
1
  class Typedcsv
2
- VERSION = '0.1.1'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typedcsv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seamus Abshere