async-service 0.22.0 → 0.23.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: b34c255ee7608b446acf8a57e86b876644f34eb21d5afa6b2a35d8f6235bb718
4
- data.tar.gz: 66b3494d6bdfb347e1ae6b1440261754132a70fa903743f5d50dc19d636ef13e
3
+ metadata.gz: 5f7f1e1833ae119be22f91c6c84073871863a49269b3173a9ed0506dbdb7afc3
4
+ data.tar.gz: a05e566aa7668b42991189b7bcea2f8e9e298a4a51545880e965e82256ac7d8e
5
5
  SHA512:
6
- metadata.gz: bc3919f55bbf3221098522a47ecc4d744cdabc97f958d4b5d63dc8ed350c4f778b414acda577304a1a2b6493132abf01562f333a67bd84f348feab260d20c9ad
7
- data.tar.gz: 9adf428ca9ddd8eb76aa0adcd67ab60268fa49bfe118d868b5fca6a75aa27749a4576f1f437f2e94855bcb2fd1013dd06ec4e8c4ec801b8c4cd99ddbbd77bf5d
6
+ metadata.gz: 64b72fff461e46bf290c993b0fbe2ca03a7014f4cecbf0af35bceb32e5303626a62bfdeb4f2bf2fe78ae07c763939ad5830e3613881af89d9b5f80e123fa20fb
7
+ data.tar.gz: 6e64b02a88d0bf6b07fe228cf125c1b6864f9f29d589e2c828b7bd6733a154b2c40f4ac7e83b4f715d28281d2284a331e13669925f81ff0bed1025df63d0aa76
checksums.yaml.gz.sig CHANGED
@@ -1 +1,2 @@
1
- 5cMq' �\u��N�C(`�7р�ֆk}:�FLt�1V�/�Q��Q�/�)g:u.�<-Zr#�&V9�����7R�M�=u�W�c��"(���}|�NX AE�e\�(��tU�=�Y7l��Hp�Qgi�O�'�II
1
+ bLՊ����:T1��ugC|Ӌ~-�zxR��,�$�زF��h��SzYJYg�/ɂx�c< QQHoR�����-��;9X��<���4 �� y��E#��x#�cqD>E��'����h.���� �y(�����l4!�6ڷض�Jl������Y8��lq�Ӥ랼�����p��;6��9�=����~K�q��p�`
2
+ Ս�C�\ )���uo �dөǃ-��$*����p4%����?#��AȈ�D��oz�������F�l���\��3)��P��9Ѳ���9x
@@ -11,12 +11,19 @@ module Async
11
11
  # Designed to be invoked within an {Async::Controller::Container}.
12
12
  class Generic
13
13
  # Convert the given environment into a service if possible.
14
+ #
15
+ # If the evaluator responds to `make_service`, it is called with the environment and its return value is used as the service. This allows environments to compose child environments and return a concrete service without a dedicated service class.
16
+ #
17
+ # Otherwise, the evaluator's `service_class` is instantiated with the environment and evaluator as arguments.
18
+ #
14
19
  # @parameter environment [Environment] The environment to use to construct the service.
15
- # @returns [Generic | Nil] The constructed service if the environment specifies a service class.
20
+ # @returns [Generic | Nil] The constructed service if the environment specifies a service class or make_service.
16
21
  def self.wrap(environment)
17
22
  evaluator = environment.evaluator
18
23
 
19
- if evaluator.key?(:service_class)
24
+ if evaluator.respond_to?(:make_service)
25
+ return evaluator.make_service(environment)
26
+ elsif evaluator.key?(:service_class)
20
27
  if service_class = evaluator.service_class
21
28
  return service_class.new(environment, evaluator)
22
29
  end
@@ -7,6 +7,6 @@
7
7
  module Async
8
8
  # @namespace
9
9
  module Service
10
- VERSION = "0.22.0"
10
+ VERSION = "0.23.0"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -31,6 +31,10 @@ Please see the [project documentation](https://socketry.github.io/async-service/
31
31
 
32
32
  Please see the [project releases](https://socketry.github.io/async-service/releases/index) for all releases.
33
33
 
34
+ ### v0.23.0
35
+
36
+ - `Async::Service::Generic.wrap` now checks for a `make_service(environment)` method on the evaluator before falling back to `service_class`. This allows environments to compose child environments and return a fully-constructed service without introducing a dedicated service class.
37
+
34
38
  ### v0.22.0
35
39
 
36
40
  - Ensure process title is updated immediately after server starts in `Managed::Service`.
@@ -78,10 +82,6 @@ Please see the [project releases](https://socketry.github.io/async-service/relea
78
82
  - Renamed `Async::Service::Managed::Service` -\> `Async::Service::ManagedService`.
79
83
  - Renamed `Async::Service::Managed::Environment` -\> `Async::Service::ManagedEnvironment`.
80
84
 
81
- ### v0.15.1
82
-
83
- - `Managed::Service` should run within `Async do ... end`.
84
-
85
85
  ## Contributing
86
86
 
87
87
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.23.0
4
+
5
+ - `Async::Service::Generic.wrap` now checks for a `make_service(environment)` method on the evaluator before falling back to `service_class`. This allows environments to compose child environments and return a fully-constructed service without introducing a dedicated service class.
6
+
3
7
  ## v0.22.0
4
8
 
5
9
  - Ensure process title is updated immediately after server starts in `Managed::Service`.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file