hasherize_csv 0.0.6 → 0.0.7
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.
- data/.travis.yml +1 -1
- data/README.md +29 -28
- data/lib/hasherize_csv.rb +1 -1
- data/lib/hasherize_csv/version.rb +1 -1
- metadata +2 -2
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,29 +1,30 @@
|
|
1
1
|
# HasherizeCsv
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
2
|
+
[](https://travis-ci.org/bbradbury/hasherize_csv)
|
3
|
+
|
4
|
+
Dead simple CSV parsing, with configurable regex selectors if required.
|
5
|
+
Reads line-by-line, so you can parse big CSV files without running out of memory.
|
6
|
+
|
7
|
+
### Simple case
|
8
|
+
Given sample_csv.csv
|
9
|
+
```csv
|
10
|
+
Col1,Col2,Col3
|
11
|
+
Val1,Val2,Val3
|
12
|
+
Val4,Val5,Val6
|
13
|
+
```
|
14
|
+
|
15
|
+
and
|
16
|
+
```ruby
|
17
|
+
require 'hasherize_csv'
|
18
|
+
@f = File.new("sample_csv.csv")
|
19
|
+
@csv = HasherizeCsv::Csv.new(@f)
|
20
|
+
|
21
|
+
@csv.each do |hash|
|
22
|
+
puts hash.inspect
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
The output will be
|
27
|
+
```
|
28
|
+
{'Col1' => 'Val1', 'Col2' => 'Val2', 'Col3' => 'Val3'}
|
29
|
+
{'Col1' => 'Val4', 'Col2' => 'Val5', 'Col3' => 'Val6'}
|
30
|
+
```
|
data/lib/hasherize_csv.rb
CHANGED
@@ -2,7 +2,7 @@ require "hasherize_csv/version"
|
|
2
2
|
|
3
3
|
module HasherizeCsv
|
4
4
|
module DefaultOpts
|
5
|
-
DEFAULT = { :separator => "\n", :value_pattern => /([^,]*),?/ }
|
5
|
+
DEFAULT = { :separator => "\n", :value_pattern => /(.[^,]*),?/ }
|
6
6
|
SALESFORCE = { :separator => "\r", :value_pattern => /\"(.*?)\"/m }
|
7
7
|
end
|
8
8
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hasherize_csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Turns csv files into hashes without reading the entire csv into memory
|
15
15
|
email:
|