parceira 0.0.3 → 0.0.4
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/README.md +8 -0
- data/lib/parceira/reader.rb +1 -1
- data/lib/parceira/version.rb +1 -1
- data/lib/parceira.rb +6 -1
- data/parceira.gemspec +1 -0
- metadata +3 -2
data/README.md
CHANGED
@@ -54,6 +54,14 @@ Product ID,Name,Price
|
|
54
54
|
|
55
55
|
> Parceira.process(filename, headers: %w(ID Name Value))
|
56
56
|
=> [{"ID"=>1, "Name"=>"Macbook Air", "Value"=>999}, {"ID"=>2, "Name"=>"Ipad mini", "Value"=>329.99}, {"ID"=>3, "Name"=>"Iphone 5", "Value"=>199.0}, {"ID"=>4, "Name"=>"MacBook Pro", "Value"=>nil}]
|
57
|
+
|
58
|
+
> Parceira.process(filename) do |data|
|
59
|
+
* puts data.inspect
|
60
|
+
> end
|
61
|
+
{:product_id=>1, :name=>"Macbook Air", :price=>999}
|
62
|
+
{:product_id=>2, :name=>"Ipad mini", :price=>329.99}
|
63
|
+
{:product_id=>3, :name=>"Iphone 5", :price=>199.0}
|
64
|
+
{:product_id=>4, :name=>"MacBook Pro", :price=>nil}
|
57
65
|
```
|
58
66
|
|
59
67
|
|
data/lib/parceira/reader.rb
CHANGED
data/lib/parceira/version.rb
CHANGED
data/lib/parceira.rb
CHANGED
@@ -15,6 +15,11 @@ include ActiveSupport::Inflector
|
|
15
15
|
|
16
16
|
module Parceira
|
17
17
|
def self.process(input, options={}, &block)
|
18
|
-
Parceira::Reader.new(input, options.symbolize_keys
|
18
|
+
records = Parceira::Reader.new(input, options.symbolize_keys).process!
|
19
|
+
if block_given?
|
20
|
+
records.each{|record| block.call(record)}
|
21
|
+
else
|
22
|
+
records
|
23
|
+
end
|
19
24
|
end
|
20
25
|
end
|
data/parceira.gemspec
CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.description = %q{Importing of CSV Files as Array(s) of Hashes with featured to process large csv files and better support for file encoding.}
|
8
8
|
gem.summary = %q{Importing of CSV Files as Array(s) of Hashes}
|
9
9
|
gem.homepage = "http://github.com/marcosgz/parceira"
|
10
|
+
gem.license = %q{MIT}
|
10
11
|
|
11
12
|
gem.add_development_dependency "rspec"
|
12
13
|
gem.add_development_dependency "guard-rspec"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parceira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -99,7 +99,8 @@ files:
|
|
99
99
|
- spec/parceira/version_spec.rb
|
100
100
|
- spec/spec_helper.rb
|
101
101
|
homepage: http://github.com/marcosgz/parceira
|
102
|
-
licenses:
|
102
|
+
licenses:
|
103
|
+
- MIT
|
103
104
|
post_install_message:
|
104
105
|
rdoc_options: []
|
105
106
|
require_paths:
|