async-service 0.7.0 → 0.8.0

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
  SHA256:
3
- metadata.gz: 8715972e602d996a04c5d8ed36f765eab4e4eda85c5f978cd9d10b66dc48fee3
4
- data.tar.gz: abd69a1148bcb121887aef3943a1a7fea9916d88c8d683ba25f1572a8f869bbb
3
+ metadata.gz: 9712448ebd0e8279fcc9820181ba9f72eb4799fc9735118fbbaea548b1650ff4
4
+ data.tar.gz: c71431b601e6fc9d5f1635a47a865b028fc7bb6c6c893c4496fe46dd73c485bb
5
5
  SHA512:
6
- metadata.gz: 9e9618479dab469fdc62db4058a25bbe2eccbc2b1c33a6b44af7b277eaa030220cd25dd5b8d720e51b2d964ecd525d123d4d423965920d2c79b4119714a866db
7
- data.tar.gz: c018787aef323da8805c471cc59a5a4fcbe21c83f789fbbbdd24cc37ff6c9b619f58dba04cf023390469632e72f9ccadb00498ef82f9198e50d691612e523b10
6
+ metadata.gz: cfb98e0d17511c3b917bfd98ed278f79f643e94cfaf2f93002076974ca2ffa0621fa8dde402d845eb5c49ba63f6d96ce23e9f864dccd233c1e17c68c610a1c5b
7
+ data.tar.gz: bcc17aa016c6b972f4155071ec819f2b54dae4c925c5bcad6a8132651dd6cc6a8f9bcbecc950a148190be7011ed80f12d2a0596958db60e78720a1f116fccaf4
checksums.yaml.gz.sig CHANGED
Binary file
@@ -5,6 +5,7 @@
5
5
 
6
6
  require_relative 'loader'
7
7
  require_relative 'generic'
8
+ require_relative 'controller'
8
9
 
9
10
  module Async
10
11
  module Service
@@ -33,14 +34,20 @@ module Async
33
34
  @environments.empty?
34
35
  end
35
36
 
36
- def services
37
- return to_enum(:services) unless block_given?
37
+ def services(implementing: nil)
38
+ return to_enum(:services, implementing: implementing) unless block_given?
38
39
 
39
40
  @environments.each do |environment|
41
+ next if implementing and environment.implements?(implementing)
42
+
40
43
  yield Generic.wrap(environment)
41
44
  end
42
45
  end
43
46
 
47
+ def controller(**options)
48
+ Controller.new(self.services(**options).to_a)
49
+ end
50
+
44
51
  # Add the environment to the configuration.
45
52
  def add(environment)
46
53
  @environments << environment
@@ -38,6 +38,10 @@ module Async
38
38
  @services = services
39
39
  end
40
40
 
41
+ # All the services associated with this controller.
42
+ # @attribute [Array(Async::Service::Generic)]
43
+ attr :services
44
+
41
45
  # Start all named services.
42
46
  def start
43
47
  @services.each do |service|
@@ -59,6 +59,12 @@ module Async
59
59
  @parent = parent
60
60
  end
61
61
 
62
+ # @attribute [Module] The facet module.
63
+ attr :facet
64
+
65
+ # @attribute [Environment | Nil] The parent environment, if any.
66
+ attr :parent
67
+
62
68
  def included(target)
63
69
  @parent&.included(target)
64
70
  target.include(@facet)
@@ -68,6 +74,10 @@ module Async
68
74
  return self.class.new(Builder.for(...), self)
69
75
  end
70
76
 
77
+ def implements?(interface)
78
+ @facet <= interface
79
+ end
80
+
71
81
  # An evaluator is lazy read-only view of an environment. It memoizes all method calls.
72
82
  class Evaluator
73
83
  def self.wrap(environment)
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Service
8
- VERSION = "0.7.0"
8
+ VERSION = "0.8.0"
9
9
  end
10
10
  end
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.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -37,7 +37,7 @@ cert_chain:
37
37
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
38
38
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
39
  -----END CERTIFICATE-----
40
- date: 2024-03-17 00:00:00.000000000 Z
40
+ date: 2024-03-22 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: async
metadata.gz.sig CHANGED
Binary file