kiba-common 0.7.0 → 0.8.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73129b07c0c847b9a1ed5b2a88e0fe3b9449200589fea6e0b88696959c86448f
4
- data.tar.gz: 1a73e5414c054fbb233c92c5459087153a6ad413bfa194c192d8ea54cd4ee3ef
3
+ metadata.gz: 76aa97f6f777aa6e96f05a088346cdca52426732a0f033b8dcfd2856d78770b8
4
+ data.tar.gz: 820fddae1f7b853075e927a5fc878a0cbbf3cbda31ad61e2b06b7a446fe8531e
5
5
  SHA512:
6
- metadata.gz: f984de5843f926e3c153c381a1e05d171275fa185c3b0b2c7d855250b75c6ed85841ad78d87cb55b9cc4d6759e7d50c585765483ef27f0c3c64f80b8a739e957
7
- data.tar.gz: 1e05cefc61c51f474f93b8f331e3d17a1de7c2ec3683212336796e3dcbc164bc9d5bc9049a8f255c25d237a8f8e38516d02db45f343a903d2bd76ad439515330
6
+ metadata.gz: a5c036121f7955527bd983afcd37ca71547d99d5b6e48f3ef88351a082b9e7729ae118f8251896c6474410ad8a8674da96140f7ea47f04dabe024aca15e64eea
7
+ data.tar.gz: 0fcec0f0342151ce1a408292b80e41852ae0094aa20887ae23abdebdee73a6604cfa3086cc980bfc6d368667460765cb28a7d6e1b11464e147545ca6ee7e6764
data/Changes.md CHANGED
@@ -1,6 +1,14 @@
1
1
  HEAD
2
2
  ----
3
3
 
4
+ 0.8.0
5
+ -----
6
+
7
+ - Bugfix: `show_me!` used with a block should not modify the processed row.
8
+
9
+ 0.7.0
10
+ -----
11
+
4
12
  - New: Kiba::Common::Transforms::SourceTransformAdapter let you transform rows into parameters for source instantiation.
5
13
 
6
14
  0.6.0
data/README.md CHANGED
@@ -48,7 +48,7 @@ But since Kiba v2 introduction of `StreamingRunner`, it is possible for transfor
48
48
 
49
49
  Leveraging that possibility, you can use a `SourceTransformAdapter` to dynamically instantiate the source for each of your input rows.
50
50
 
51
- This allows to mix-and-match components in a much more versatile & powerful way.
51
+ This allows you to mix-and-match components in a much more versatile & powerful way.
52
52
 
53
53
  Requirements: Kiba v2 with `StreamingRunner` enabled.
54
54
 
@@ -85,7 +85,7 @@ require 'kiba-common/transforms/enumerable_exploder'
85
85
  transform Kiba::Common::Transforms::EnumerableExploder
86
86
  ```
87
87
 
88
- For instance, this can help if you are reading XML/JSON documents from a source, and each input document contains multiple rows that you'd want to extract.
88
+ This can help if you are reading XML/JSON documents from a source and each input document contains multiple rows that you want to extract.
89
89
 
90
90
  ```ruby
91
91
  source Kiba::Common::Sources::Enumerable, -> { Dir["input/*.xml"] }
@@ -104,7 +104,7 @@ Similarly, if you have a CSV document as your input:
104
104
  | ------------- | ------------- |
105
105
  | 00001 | John:Mary:Sally |
106
106
 
107
- and you want to reformat it to get this instead:
107
+ and you want to reformat it to the following:
108
108
 
109
109
  | po_number | buyer |
110
110
  |-------------|---------|
@@ -135,11 +135,11 @@ A way to dump `Hash` rows as CSV.
135
135
 
136
136
  All rows are expected to have the exact same set of keys as the first row.
137
137
 
138
- The headers will be the first row keys, unless you pass an array of keys via `headers`.
138
+ The headers will be the first row keys unless you pass an array of keys via `headers`.
139
139
 
140
- All keys are mandatory (although they can have a nil value).
140
+ All keys are mandatory (although they can have a `nil` value).
141
141
 
142
- Use the `csv_options` keyword to control the output format like you would do when using [Ruby CSV class](http://ruby-doc.org/stdlib-2.4.0/libdoc/csv/rdoc/CSV.html#method-c-new).
142
+ Use the `csv_options` keyword to control the output format like when using [Ruby CSV class](http://ruby-doc.org/stdlib-2.4.0/libdoc/csv/rdoc/CSV.html#method-c-new).
143
143
 
144
144
  Usage:
145
145
 
@@ -189,7 +189,7 @@ logger = Logger.new(xxx)
189
189
 
190
190
  ### Kiba::Common::DSLExtensions::ShowMe
191
191
 
192
- A way to color-dump rows on the screen, useful at development time while you are looking at the data (requires the `awesome_print` gem).
192
+ A way to color-dump rows on the screen, useful during development when you are inspecting the data (requires the `awesome_print` gem).
193
193
 
194
194
  Usage:
195
195
 
@@ -212,6 +212,8 @@ show_me! { |r| r.except(:some_noisy_field) }
212
212
 
213
213
  ## Contributing & Legal
214
214
 
215
+ See [LICENSE](LICENSE) for license.
216
+
215
217
  (agreement below borrowed from Sidekiq Legal)
216
218
 
217
219
  By submitting a Pull Request, you disavow any rights or claims to any changes submitted to the Kiba Common project and assign the copyright of those changes to LoGeek SARL.
@@ -6,12 +6,12 @@ module Kiba
6
6
  # Color print your row.
7
7
  module ShowMe
8
8
  def show_me!(&pre_process)
9
- transform do |row|
10
- row = pre_process ? pre_process.call(row) : row
9
+ transform do |original_row|
10
+ row = pre_process ? pre_process.call(original_row) : original_row
11
11
  # NOTE: invoking Kernel.ap for testing since
12
12
  # ap itself is harder to mock (Kiba Context)
13
13
  Kernel.ap(row)
14
- row
14
+ original_row
15
15
  end
16
16
  end
17
17
  end
@@ -1,5 +1,5 @@
1
1
  module Kiba
2
2
  module Common
3
- VERSION = '0.7.0'
3
+ VERSION = '0.8.0'
4
4
  end
5
5
  end
@@ -18,14 +18,18 @@ class TestShowMe < Minitest::Test
18
18
  end
19
19
 
20
20
  def test_show_me_pre_process
21
+ output = []
21
22
  job = Kiba.parse do
22
23
  extend Kiba::Common::DSLExtensions::ShowMe
23
24
  source Kiba::Common::Sources::Enumerable, [{this: "OK", not_this: "KO"}]
24
25
  show_me! { |r| r.fetch(:this) }
26
+ destination TestArrayDestination, output
25
27
  end
26
28
 
27
29
  assert_called(Kernel, :ap, ['OK']) do
28
30
  Kiba.run(job)
29
31
  end
32
+
33
+ assert_equal [{this: "OK", not_this: "KO"}], output
30
34
  end
31
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiba-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibaut Barrère
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-06 00:00:00.000000000 Z
11
+ date: 2018-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kiba