ruby_pipeline 1.0.1 → 1.0.2
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 +4 -4
- data/README.md +5 -0
- data/lib/ruby_pipeline/base_pipeline.rb +2 -1
- data/lib/ruby_pipeline/configuration.rb +2 -1
- data/lib/ruby_pipeline/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cc7cfeb3879fd62c07181a10e3baebd2afde5a8548980753280a204faad2df6
|
4
|
+
data.tar.gz: c33bc404cfdd411519b93c0974844ad36531f0a501291d8474408ebbd2f1bd1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeb401777d2f58447d94e445930bae2902d6b4de5440608bdba59bdb1b1cba5535b96e1886230653dd5a01f5824edf015bfa19193bac693a5a64c3d328b30877
|
7
|
+
data.tar.gz: 60bc128f2c34d17cad5f1c44152540f8e795d27e239961eed29f8b8fd2ec3b4848ae1a1666f4ce963cda23068022b182731787a3521856321983a31170679b90
|
data/README.md
CHANGED
@@ -67,6 +67,11 @@ You can configure a success callback to be called after each step is processed:
|
|
67
67
|
RubyPipeline.configure do |config|
|
68
68
|
config.success_callback = ->(step) { my_monitoring_service.notify(step) }
|
69
69
|
config.failure_callback = ->(step) { puts "Failure in step #{step}" }
|
70
|
+
config.time_callback = lambda do |step, &block|
|
71
|
+
my_timing_service.time(step) do
|
72
|
+
block.call # Important to call the block, otherwise the pipeline will not continue
|
73
|
+
end
|
74
|
+
end
|
70
75
|
end
|
71
76
|
```
|
72
77
|
|
@@ -8,7 +8,7 @@ module RubyPipeline
|
|
8
8
|
|
9
9
|
def process(input = nil)
|
10
10
|
steps.inject(input) do |memo, step|
|
11
|
-
step_result = step.process(memo)
|
11
|
+
step_result = time(step) { step.process(memo) }
|
12
12
|
|
13
13
|
break failure(step) if step_result.nil?
|
14
14
|
|
@@ -23,6 +23,7 @@ module RubyPipeline
|
|
23
23
|
|
24
24
|
def default_steps = []
|
25
25
|
|
26
|
+
def time(step, &) = RubyPipeline.configuration.time_callback.call(step, &)
|
26
27
|
def success(step) = RubyPipeline.configuration.success_callback.call(step)
|
27
28
|
|
28
29
|
def failure(step)
|
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
module RubyPipeline
|
4
4
|
class Configuration
|
5
|
-
attr_accessor :success_callback, :failure_callback
|
5
|
+
attr_accessor :success_callback, :failure_callback, :time_callback
|
6
6
|
|
7
7
|
def initialize
|
8
8
|
@success_callback = ->(step) {}
|
9
9
|
@failure_callback = ->(step) {}
|
10
|
+
@time_callback = ->(_step, &block) { block.call }
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Vaughan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email: ian@out.fund
|