async-service 0.7.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/service/configuration.rb +9 -2
- data/lib/async/service/controller.rb +4 -0
- data/lib/async/service/environment.rb +21 -5
- data/lib/async/service/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1e2ef9fcbc4732f3683889f55acfd02fa632aa95189c0767c04c8b24f64eb52
|
4
|
+
data.tar.gz: debef0f6bdc887b83dc8ebf1dfbf63bf9ab0591a4b99a52a8c1aa6ccd47a419c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ec21ead9612856e07467c62d3d52fa3452ca7883455f9a67c78743f61a9db512063550356a2ca9b5e374313dfccc64dbe909205c8410b6efd8ccf2b52fc4cc4
|
7
|
+
data.tar.gz: 0aa73567ad8f19c62c5c630ae9c4bc02fa5c2ba253a4882326e08b9ce9090c14a4c73e29241320e280136aa23e5e783d6ff7f06b63a3806c2464717c067318db
|
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
|
@@ -7,20 +7,26 @@ module Async
|
|
7
7
|
module Service
|
8
8
|
class Environment
|
9
9
|
class Builder < BasicObject
|
10
|
-
def self.for(
|
11
|
-
|
10
|
+
def self.for(*facets, **values, &block)
|
11
|
+
top = ::Module.new
|
12
|
+
|
13
|
+
builder = self.new(top)
|
14
|
+
|
15
|
+
facets.each do |facet|
|
16
|
+
builder.include(facet)
|
17
|
+
end
|
12
18
|
|
13
19
|
values.each do |key, value|
|
14
20
|
if value.is_a?(::Proc)
|
15
|
-
|
21
|
+
builder.method_missing(key, &value)
|
16
22
|
else
|
17
|
-
|
23
|
+
builder.method_missing(key, value)
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
21
27
|
builder.instance_exec(&block) if block_given?
|
22
28
|
|
23
|
-
return
|
29
|
+
return top
|
24
30
|
end
|
25
31
|
|
26
32
|
def initialize(facet = ::Module.new)
|
@@ -59,6 +65,12 @@ module Async
|
|
59
65
|
@parent = parent
|
60
66
|
end
|
61
67
|
|
68
|
+
# @attribute [Module] The facet module.
|
69
|
+
attr :facet
|
70
|
+
|
71
|
+
# @attribute [Environment | Nil] The parent environment, if any.
|
72
|
+
attr :parent
|
73
|
+
|
62
74
|
def included(target)
|
63
75
|
@parent&.included(target)
|
64
76
|
target.include(@facet)
|
@@ -68,6 +80,10 @@ module Async
|
|
68
80
|
return self.class.new(Builder.for(...), self)
|
69
81
|
end
|
70
82
|
|
83
|
+
def implements?(interface)
|
84
|
+
@facet <= interface
|
85
|
+
end
|
86
|
+
|
71
87
|
# An evaluator is lazy read-only view of an environment. It memoizes all method calls.
|
72
88
|
class Evaluator
|
73
89
|
def self.wrap(environment)
|
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.
|
4
|
+
version: 0.9.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-
|
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
|