nebulous 0.0.4 → 0.0.5

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: 15734d97663b72356a0c85a85a07e5bddc191a0f
4
- data.tar.gz: a2fdc1e48d2835bc8a6e509733cbbb5a09ed9bdd
3
+ metadata.gz: bf7777af004a3e807166622d2e9cc01beb8b6d04
4
+ data.tar.gz: 59ad738d6c9b7ff3a81e9f476d1727f187dd9537
5
5
  SHA512:
6
- metadata.gz: d98c33418a5c0c497027d57491e8e3698357bd35762b9c11efe67e8d97dce7458693b4129d52516d155e498ff3023b825c6c04e224e679e5f681fa17886dfd3f
7
- data.tar.gz: 43845b83b364c806fa803affe6b5c8981af2286a68e0ca157d321c63328b0c27ddfb4e7d4f451ba82e5bb5dff7ba617513282c1ef8aa1258f9b106c2bd885862
6
+ metadata.gz: d9bc42df4140f2965205a2f8ae8379df12e9e18465b80a4264b74952d2ba7b262b4b50d78695bda7dc4a2889bcb4e18c4ef9e3268db7524cfd1cdf2b5ddd8d7a
7
+ data.tar.gz: 3bc3793318ea8bc82e0d839c0044a210c6906fe2ac5fe2652b214f9df7532e62d0ff2ccfce34add2ffbf61601219581c5b38a4593952f1db586cf32a70f12c82
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nebulous (0.0.3)
4
+ nebulous (0.0.4)
5
5
  activesupport
6
6
  cocaine (~> 0.5)
7
7
 
data/README.md CHANGED
@@ -18,6 +18,48 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
+ Nebulous is a bit easier going than other CSV libraries for Ruby. It will parse
22
+ data that would otherwise fail with Ruby's CSV and supports the common problems
23
+ that are present in real-world CSV files. Nebulous will also try to intelligently
24
+ determine the column delimiters and line terminators before parsing so you don't
25
+ have to. Which makes handling CSV file uploads a breeze when you have no idea
26
+ what you might get. Let's cover some examples.
27
+
28
+ Nebulous.process "path/to/file.csv"
29
+ => [{:first_name=>"Meghan", :last_name=>"Koch"},
30
+ {:first_name=>"Genoveva", :last_name=>"Dare"}, ...]
31
+
32
+ Or process within a block in chunks of 10
33
+
34
+ Nebulous.process "path/to/file.csv", chunk: 10 do |chunk|
35
+ p chunk
36
+ end
37
+ => [{:first_name=>"Meghan", :last_name=>"Koch"},
38
+ {:first_name=>"Genoveva", :last_name=>"Dare"}, ...]
39
+ => [{:first_name=>"Chad", :last_name=>"Anderson"},
40
+ {:first_name=>"Arnold", :last_name=>"Yundt"}, ...]
41
+
42
+
43
+ Or provide your own header mapping to normalize columns:
44
+
45
+ map = {first_name: :col1, last_name: :col2 }
46
+ Nebulous.process "path/to/file.csv", mapping: map
47
+ => [{:col1=>"どーもありがとう", :col2=>"ミスター·ロボット"},
48
+ {:col1=>"Meghan", :col2=>"Koch"},
49
+ {:col1=>"Genoveva", :col2=>"Dare"}]
50
+
51
+
52
+ If you know your CSV file does not contain headers it will return simple Arrays.
53
+
54
+ Nebulous.process "path/to/file.csv", headers: false
55
+ => [["どーもありがとう", "ミスター·ロボット"],
56
+ ["Meghan", "Koch"],
57
+ ["Genoveva", "Dare"]]
58
+
59
+ Or provide a limit:
60
+
61
+ Nebulous.process "path/to/file.csv", limit: 1
62
+ => [{:first_name=>"どーもありがとう", :last_name=>"ミスター·ロボット"}]
21
63
 
22
64
 
23
65
  ## Contributing
@@ -24,7 +24,7 @@ module Nebulous
24
24
 
25
25
  def yield_chunk(chunk, &_block)
26
26
  if chunk.full? || file.eof?
27
- yield chunk.map(&:to_a)
27
+ yield chunk
28
28
  @chunk = nil
29
29
  end
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module Nebulous
2
- VERSION = '0.0.4'.freeze
2
+ VERSION = '0.0.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nebulous
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Graves