hasherize_csv 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -4,7 +4,7 @@ env:
4
4
  - CI=true
5
5
  rvm:
6
6
  - 1.8.7
7
- - rbx-19mode
7
+ # - rbx-19mode
8
8
  - jruby-19mode
9
9
  - jruby-head
10
10
  - 1.9.2
data/README.md CHANGED
@@ -1,29 +1,30 @@
1
1
  # HasherizeCsv
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'hasherize_csv'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install hasherize_csv
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Contributing
24
-
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
2
+ [![Build Status](https://travis-ci.org/bbradbury/hasherize_csv.png)](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
 
@@ -1,3 +1,3 @@
1
1
  module HasherizeCsv
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
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.6
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: 2012-10-29 00:00:00.000000000 Z
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: