metacrunch-file 1.3.0 → 1.3.1

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
  SHA256:
3
- metadata.gz: 9980829422c838552b9334134e52932f3d70d132859965baa70a93f184ffefaf
4
- data.tar.gz: 81b3b88c8725eb30469eb1dd40a7f9507865e66a998b76ff2ace5691e424b684
3
+ metadata.gz: 4f48a935e53642f8c9ad1950a9ba8000d4e87b027c3e84cbcc83f88d337cb240
4
+ data.tar.gz: 67e654f8e28bebd82e25f91a8ea1e5bd31687bb9ff8462425e9fca7bd5d3c0a0
5
5
  SHA512:
6
- metadata.gz: '090856c4f3cef0b0bc2bedaa2a5fd87ef73005b4678e2bbe5a938475438701b1ed74307dc502bfd5f52614589ed6ef1f55667037d0c1599ecd8ae8c1fb68d8dc'
7
- data.tar.gz: b940c2ea0555e018303de286a028e975d1cd628cd527d65ca702afb97d7bbac40cc31cad67b27871b3737891b65f016ccff31b960ba761af0cb4157cb033195e
6
+ metadata.gz: d431451479609104391aaaf493665894f34f267beb635ce42073ec844a623a20763f259ff01721c63a0927608124fc4fe7e7413f1391babe159cdb7cdde8bf23
7
+ data.tar.gz: d3aac69ba1a203ba323afd8bfa0b108640e80c59ac2b8a7c6786f9538840e5b47526c0623e3d74099a4cb5869c89b0f202d9a78ebaeccaf0b13d63bc1a9e88a4
data/.circleci/config.yml CHANGED
@@ -1,12 +1,8 @@
1
- # Ruby CircleCI 2.0 configuration file
2
- #
3
- # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
- #
5
1
  version: 2
6
2
  jobs:
7
3
  build:
8
4
  docker:
9
- - image: circleci/ruby:2.4.1-node-browsers
5
+ - image: circleci/ruby:2.6-node-browsers
10
6
 
11
7
  working_directory: ~/repo
12
8
 
data/Readme.md CHANGED
@@ -84,6 +84,12 @@ destination Metacrunch::File::FileDestination.new("/tmp/my-data.txt" [, OPTIONS]
84
84
 
85
85
  This class provides a metacrunch `source` for reading CSV files. It is a simple wrapper around [smarter_csv](https://github.com/tilo/smarter_csv) gem.
86
86
 
87
+ ```ruby
88
+ # my_job.metacrunch
89
+
90
+ source Metacrunch::File::CSVSource.new("my.csv" [, OPTIONS])
91
+ ```
92
+
87
93
  **Options**
88
94
 
89
95
  * `headers`: Whether or not the file contains headers as the first line. Important if the file does not contain headers, otherwise you would lose the first line of data. Defaults to `true`.
@@ -1,5 +1,5 @@
1
1
  module Metacrunch
2
2
  module File
3
- VERSION = "1.3.0"
3
+ VERSION = "1.3.1"
4
4
  end
5
5
  end
@@ -20,9 +20,17 @@ module Metacrunch
20
20
  @sheet.add_row(columns, types: :string)
21
21
  end
22
22
 
23
- def write(row)
24
- return if row.blank?
25
- @sheet.add_row(row, types: :string)
23
+ def write(data)
24
+ return if data.blank?
25
+ raise ArgumentError, "Data must be an Array" unless data.is_a?(Array)
26
+
27
+ if data.first.is_a?(Array)
28
+ data.each do |d|
29
+ @sheet.add_row(d, types: :string)
30
+ end
31
+ else
32
+ @sheet.add_row(data, types: :string)
33
+ end
26
34
  end
27
35
 
28
36
  def close
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metacrunch-file
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - René Sprotte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-09 00:00:00.000000000 Z
11
+ date: 2019-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport