kiba-common 0.0.1 → 0.0.2

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: 5153e0740d046e6d86b11e47d1cd36263be8a019
4
- data.tar.gz: d9b397babdae819a175ec9aac6d01aae9c46ae4b
3
+ metadata.gz: e9a78f79fe5c727bce8d34e47d627ab90989373a
4
+ data.tar.gz: 1e5c2928148dbd5a4179f4e28fc4a575d3c0f586
5
5
  SHA512:
6
- metadata.gz: c149dd10f8544df9947954e567c3ded033b888825245ff992bdcff0cbf9a4510f933cf0d281b66dc4e35502cbac075bf2196c52a0633e7c69dad9771f0c06dee
7
- data.tar.gz: 72a48a33d211f710dc63edeb5faa1513d22994b91e7948168462ea74692a3e4fee1f3d3b3566e8413561d5ee78e3535af3c88b6a52ec9620015d5bb4b5ed563c
6
+ metadata.gz: 2073edaeeea322fc85fbf0909c439d53465669b1b0a1de99bff42d73d6673fb3a43f11080da344da3dc00d6cf39f14292adfbe073873762a96a7a890b9b73a2e
7
+ data.tar.gz: bf8d5816f1d0801a848fa0991e37b219dc0d1601a375aa8cdbf843c835a9ac7481ecbef6dd7f49557c582add51a13e081965eb5f5cc9e5c50e7a487a4ef7a285
data/Changes.md CHANGED
@@ -1,5 +1,13 @@
1
1
  HEAD
2
2
  ----
3
3
 
4
+ 0.0.2
5
+ ----
6
+
7
+ - Update: `show_me!` can be called with a block to pre-process the row before printing.
8
+
9
+ 0.0.1
10
+ -----
11
+
4
12
  - New: Kiba::Common::DSLExtensions::ShowMe (useful to color-print rows during development)
5
13
  - New: Kiba::Common::DSLExtensions::Logger (production logging)
data/README.md CHANGED
@@ -1,16 +1,18 @@
1
1
  Kiba Common is a companion gem to [Kiba](https://github.com/thbar/kiba) and [Kiba Pro](https://github.com/thbar/kiba/blob/master/Pro-Changes.md) in which I'll share commonly used helpers.
2
2
 
3
- Please consider it a work-in-progress for the time being.
3
+ [![Build Status](https://travis-ci.org/thbar/kiba-common.svg?branch=master)](https://travis-ci.org/thbar/kiba-common) [![Gem Version](https://badge.fury.io/rb/kiba-common.svg)](https://badge.fury.io/rb/kiba-common)
4
4
 
5
- In particular, review the changes when updating, until a proper release is ready.
5
+ ## Usage
6
6
 
7
- [![Build Status](https://travis-ci.org/thbar/kiba-common.svg?branch=master)](https://travis-ci.org/thbar/kiba-common)
7
+ Add `kiba-common` to your `Gemfile`:
8
8
 
9
- ## Usage
9
+ ```ruby
10
+ gem 'kiba-common'
11
+ ```
10
12
 
11
- **Do not try to use a gem version**. While the name has been [reserved](https://rubygems.org/gems/kiba-common), the gem is not yet published for real. Use git master directly.
13
+ Then see below for each module usage & require clause.
12
14
 
13
- ## Currently available
15
+ ## Available extensions
14
16
 
15
17
  ### Kiba::Common::DSLExtensions::Logger
16
18
 
@@ -53,6 +55,14 @@ transform MyTransform
53
55
  show_me! # will color-print the row at this step of the pipeline
54
56
  ```
55
57
 
58
+ You can also pre-process the data to only show specific parts of the row:
59
+
60
+ ```ruby
61
+ require 'active_support/core_ext/hash/except'
62
+
63
+ show_me! { |r| r.except(:some_noisy_field) }
64
+ ```
65
+
56
66
  ## Contributing & Legal
57
67
 
58
68
  (agreement below borrowed from Sidekiq Legal)
@@ -61,4 +71,4 @@ By submitting a Pull Request, you disavow any rights or claims to any changes su
61
71
 
62
72
  If you cannot or do not want to reassign those rights (your employment contract for your employer may not allow this), you should not submit a PR. Open an issue and someone else can do the work.
63
73
 
64
- This is a legal way of saying "If you submit a PR to us, that code becomes ours". 99.9% of the time that's what you intend anyways; we hope it doesn't scare you away from contributing.
74
+ This is a legal way of saying "If you submit a PR to us, that code becomes ours". 99.9% of the time that's what you intend anyways; we hope it doesn't scare you away from contributing.
@@ -5,8 +5,9 @@ module Kiba
5
5
  module DSLExtensions
6
6
  # Color print your row.
7
7
  module ShowMe
8
- def show_me!
8
+ def show_me!(&pre_process)
9
9
  transform do |row|
10
+ row = pre_process ? pre_process.call(row) : row
10
11
  # NOTE: invoking Kernel.ap for testing since
11
12
  # ap itself is harder to mock (Kiba Context)
12
13
  Kernel.ap(row)
@@ -1,5 +1,5 @@
1
1
  module Kiba
2
2
  module Common
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
data/test/test_show_me.rb CHANGED
@@ -16,4 +16,16 @@ class TestShowMe < Minitest::Test
16
16
  Kiba.run(job)
17
17
  end
18
18
  end
19
+
20
+ def test_show_me_pre_process
21
+ job = Kiba.parse do
22
+ extend Kiba::Common::DSLExtensions::ShowMe
23
+ source TestEnumerableSource, [{this: "OK", not_this: "KO"}]
24
+ show_me! { |r| r.fetch(:this) }
25
+ end
26
+
27
+ assert_called(Kernel, :ap, ['OK']) do
28
+ Kiba.run(job)
29
+ end
30
+ end
19
31
  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.0.1
4
+ version: 0.0.2
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: 2017-12-11 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kiba
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.6.14
112
+ rubygems_version: 2.6.13
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Commonly used helpers for Kiba ETL