the_help 3.3.0 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +14 -14
- data/lib/the_help/provides_callbacks.rb +4 -2
- data/lib/the_help/service.rb +19 -7
- data/lib/the_help/version.rb +1 -1
- metadata +2 -3
- data/.circleci/config.yml +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23549e882a292bcd3a220b22e6761eca139ac452d0a5f4f7a46b318ba2702570
|
4
|
+
data.tar.gz: ab250ee41c17c458c54e9817a9cebe1781c36ce4211f7ed0bf274f4e28f63ea1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 469d1d7513a3dd6cf7b6b5d9a34eb0580b0cbe3c5205996b1ef7240f8312777b4d44c17852c87ff435231c6f0d6a493588fc0f8097a9fa4e414a80fc6ba239a9
|
7
|
+
data.tar.gz: 99b3277a01c99017f2ba8f787a23a56da16a564a6a2e00ae8488f1af0e72844f100b34348c2ee2e79682f73160c3b3e4fe73497ff82bd3760d533446df88cbd9
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# TheHelp Changelog #
|
2
2
|
|
3
|
+
## 3.4.0 ##
|
4
|
+
|
5
|
+
* added `TheHelp::Service#delegate_to_service` method that can be used inside a service definition
|
6
|
+
in order to have the current service delegate to another service and use the other service's
|
7
|
+
result as its own.
|
8
|
+
|
3
9
|
## 3.3.0 ##
|
4
10
|
|
5
11
|
* Calling `#stop!` with no arguments in a service definition will now check that a result was set
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
the_help (3.
|
4
|
+
the_help (3.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.4.1)
|
10
10
|
byebug (11.1.3)
|
11
|
-
diff-lcs (1.
|
11
|
+
diff-lcs (1.5.0)
|
12
12
|
parallel (1.19.2)
|
13
13
|
parser (2.7.2.0)
|
14
14
|
ast (~> 2.4.1)
|
@@ -16,19 +16,19 @@ GEM
|
|
16
16
|
rake (13.0.1)
|
17
17
|
regexp_parser (1.8.2)
|
18
18
|
rexml (3.2.4)
|
19
|
-
rspec (3.
|
20
|
-
rspec-core (~> 3.
|
21
|
-
rspec-expectations (~> 3.
|
22
|
-
rspec-mocks (~> 3.
|
23
|
-
rspec-core (3.
|
24
|
-
rspec-support (~> 3.
|
25
|
-
rspec-expectations (3.
|
19
|
+
rspec (3.10.0)
|
20
|
+
rspec-core (~> 3.10.0)
|
21
|
+
rspec-expectations (~> 3.10.0)
|
22
|
+
rspec-mocks (~> 3.10.0)
|
23
|
+
rspec-core (3.10.1)
|
24
|
+
rspec-support (~> 3.10.0)
|
25
|
+
rspec-expectations (3.10.1)
|
26
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-mocks (3.
|
27
|
+
rspec-support (~> 3.10.0)
|
28
|
+
rspec-mocks (3.10.2)
|
29
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-support (3.
|
30
|
+
rspec-support (~> 3.10.0)
|
31
|
+
rspec-support (3.10.3)
|
32
32
|
rubocop (0.93.1)
|
33
33
|
parallel (~> 1.10)
|
34
34
|
parser (>= 2.7.1.5)
|
@@ -56,4 +56,4 @@ DEPENDENCIES
|
|
56
56
|
yard
|
57
57
|
|
58
58
|
BUNDLED WITH
|
59
|
-
|
59
|
+
2.2.15
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'set'
|
4
|
+
|
3
5
|
module TheHelp
|
4
6
|
# Adds a callback DSL to including classes
|
5
7
|
#
|
@@ -129,12 +131,12 @@ module TheHelp
|
|
129
131
|
|
130
132
|
def _provides_callbacks_define_wrapper(name, without_logging)
|
131
133
|
make_public = public_method_defined?(name)
|
132
|
-
define_method(name) do |*args|
|
134
|
+
define_method(name) do |*args, **options|
|
133
135
|
if defined?(logger)
|
134
136
|
logger.debug("#{self.class.name}/#{__id__} received callback " \
|
135
137
|
":#{name}.")
|
136
138
|
end
|
137
|
-
send(without_logging, *args)
|
139
|
+
send(without_logging, *args, **options)
|
138
140
|
self
|
139
141
|
end
|
140
142
|
private name unless make_public
|
data/lib/the_help/service.rb
CHANGED
@@ -106,8 +106,8 @@ module TheHelp
|
|
106
106
|
# Convenience method to instantiate the service and immediately call it
|
107
107
|
#
|
108
108
|
# Any arguments are passed to #initialize
|
109
|
-
def call(*args, &block)
|
110
|
-
new(*args).call(&block)
|
109
|
+
def call(*args, **options, &block)
|
110
|
+
new(*args, **options).call(&block)
|
111
111
|
end
|
112
112
|
|
113
113
|
# :nodoc:
|
@@ -324,10 +324,12 @@ module TheHelp
|
|
324
324
|
stop!
|
325
325
|
end
|
326
326
|
|
327
|
-
def stop!(type: :error,
|
328
|
-
|
327
|
+
def stop!(type: :error, **opts)
|
328
|
+
value = opts.fetch(:value) { |key|
|
329
329
|
check_result!
|
330
|
-
|
330
|
+
throw :stop
|
331
|
+
}
|
332
|
+
if type == :success
|
331
333
|
result.success value
|
332
334
|
else
|
333
335
|
result.error value
|
@@ -339,13 +341,23 @@ module TheHelp
|
|
339
341
|
raise TheHelp::NoResultError if result.pending?
|
340
342
|
end
|
341
343
|
|
342
|
-
def run_callback(callback, *args)
|
344
|
+
def run_callback(callback, *args, **options)
|
343
345
|
continue = false
|
344
346
|
continue = catch(:stop) do
|
345
|
-
|
347
|
+
if options.empty?
|
348
|
+
# Satisfies Ruby 2.4 and friends - where straightforward `, **options`
|
349
|
+
# still lands as separated `{}` parameter into the lambda..
|
350
|
+
callback.call(*args)
|
351
|
+
else
|
352
|
+
callback.call(*args, **options)
|
353
|
+
end
|
346
354
|
true
|
347
355
|
end
|
348
356
|
self.stop_caller ||= !continue
|
349
357
|
end
|
358
|
+
|
359
|
+
def delegate_to_service(*args, **options)
|
360
|
+
call_service(*args, **options) { |result| @result = result }
|
361
|
+
end
|
350
362
|
end
|
351
363
|
end
|
data/lib/the_help/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_help
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Wilger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -87,7 +87,6 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- ".circleci/config.yml"
|
91
90
|
- ".gitignore"
|
92
91
|
- ".rspec"
|
93
92
|
- ".rubocop.yml"
|
data/.circleci/config.yml
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# Ruby CircleCI 2.0 configuration file
|
2
|
-
#
|
3
|
-
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
-
#
|
5
|
-
version: 2
|
6
|
-
jobs:
|
7
|
-
build:
|
8
|
-
docker:
|
9
|
-
# specify the version you desire here
|
10
|
-
- image: circleci/ruby:2.4.1
|
11
|
-
|
12
|
-
steps:
|
13
|
-
- checkout
|
14
|
-
|
15
|
-
# Download and cache dependencies
|
16
|
-
- restore_cache:
|
17
|
-
keys:
|
18
|
-
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
19
|
-
# fallback to using the latest cache if no exact match is found
|
20
|
-
- v1-dependencies-
|
21
|
-
|
22
|
-
- run:
|
23
|
-
name: install dependencies
|
24
|
-
command: |
|
25
|
-
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
26
|
-
|
27
|
-
- save_cache:
|
28
|
-
paths:
|
29
|
-
- ./vendor/bundle
|
30
|
-
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
31
|
-
|
32
|
-
# run tests!
|
33
|
-
- run:
|
34
|
-
name: run tests
|
35
|
-
command: bundle exec rspec
|