arc-furnace 0.1.25 → 0.1.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arc-furnace/csv_source.rb +8 -5
- data/lib/arc-furnace/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8616333ef28ee9771d48ce344eb65cee268fa7c
|
4
|
+
data.tar.gz: 8cffb861684c0bceb62a3e6c7e4f01544a4f7661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbc864ac6041d62b326206394cca3fe700727fc6dd935b60c1233c45b5030302599bec7dd14941f8278b607025abb04f2369d0bc0c3a1923f5414c323d5de88a
|
7
|
+
data.tar.gz: 812167e9e9a3a892db6d1329baee88fa8251f0368d4e6dc0cd309f1ccccc6b6170d0b8697fe084f8e97bbdd69cd3c668fddfe9dd94664c2a95364eea2b0756f0
|
@@ -5,20 +5,23 @@ require 'csv'
|
|
5
5
|
module ArcFurnace
|
6
6
|
class CSVSource < EnumeratorSource
|
7
7
|
include CSVToHashWithDuplicateHeaders
|
8
|
-
attr_reader :value, :file
|
8
|
+
attr_reader :value, :file, :csv
|
9
9
|
|
10
|
-
def initialize(filename: , encoding: 'UTF-8')
|
11
|
-
@file = File.open(filename, encoding: encoding)
|
10
|
+
def initialize(filename: nil, csv: nil, encoding: 'UTF-8')
|
11
|
+
@file = File.open(filename, encoding: encoding) if filename
|
12
|
+
@csv = csv
|
12
13
|
super()
|
13
14
|
end
|
14
15
|
|
15
16
|
def finalize
|
16
|
-
file.close
|
17
|
+
file.close if file
|
17
18
|
end
|
18
19
|
|
19
20
|
def build_enumerator
|
20
21
|
Enumerator.new do |yielder|
|
21
|
-
CSV.new(file, headers: true).each
|
22
|
+
(csv ? csv : CSV.new(file, headers: true)).each do |row|
|
23
|
+
yielder << csv_to_hash_with_duplicates(row)
|
24
|
+
end
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
data/lib/arc-furnace/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arc-furnace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Spangenberger
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
231
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.
|
232
|
+
rubygems_version: 2.4.5.1
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: Melds and transforms data from multiple sources into a single stream
|