async-service 0.5.1 → 0.6.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: b44bdc3df0be460edd3c80eb2c720cac60a8468d07ff2a72e9319098d772e99d
4
- data.tar.gz: 39e6aafef8d74711a9136f44bede0266401d68d852c840f72c02d14bb6278c5c
3
+ metadata.gz: c1a6b9d6b8b28e029a194d907ca333a9394f3cf4c0a046193ddc9825d9c415d9
4
+ data.tar.gz: '082c310afc5f25e5fb053068e6b7e71facbbebc0794ec221a682edd2d069abee'
5
5
  SHA512:
6
- metadata.gz: 9e866b56bc410daa6d203fdeccf141c0b85d13c27cc8af84c4953ff69e02b1b70fd52dd0e71179ad87802a2afeab60c66b5ce6572172fa8132ccb69c42480f10
7
- data.tar.gz: b11bf4b2759197f1a9ac3e07d0a9a2630172c1d86b13a1cc63990125bc894dd5fb39f166c896e5480de4d7ee6cc917c5469f3e67cae999c20510d4558b4aec61
6
+ metadata.gz: 608449e59014ab19293db0fbf67a826677d954b48c1fae24096b6984d63e5db326657bf091d696f9786406fac7bc2a78e4bd3ba0fa0bc5c02a8cbc5bc66b8b43
7
+ data.tar.gz: 1ec0ba61d8afc8aa5f44408e5935717b536b30e994689bd93e10dfe4ba0db6a22b112d905aba4c95a1280b2009ff0f9e73e7eabd173e8ab6920bb05dff29e2ba
checksums.yaml.gz.sig CHANGED
Binary file
@@ -7,8 +7,10 @@ module Async
7
7
  module Service
8
8
  class Environment
9
9
  class Builder < BasicObject
10
- def self.wrap(hash, facet = ::Module.new)
11
- hash.each do |key, value|
10
+ def self.for(facet = ::Module.new, **values, &block)
11
+ builder = self.new(facet)
12
+
13
+ values.each do |key, value|
12
14
  if value.is_a?(::Proc)
13
15
  facet.define_method(key, &value)
14
16
  else
@@ -16,12 +18,6 @@ module Async
16
18
  end
17
19
  end
18
20
 
19
- return facet
20
- end
21
-
22
- def self.for(facet = ::Module.new, &block)
23
- builder = self.new(facet)
24
-
25
21
  builder.instance_exec(&block) if block_given?
26
22
 
27
23
  return facet
@@ -50,16 +46,8 @@ module Async
50
46
  end
51
47
  end
52
48
 
53
- def self.build(**values, &block)
54
- if values.any?
55
- environment = Environment.new(Builder.wrap(values))
56
- end
57
-
58
- if block_given?
59
- environment = Environment.new(Builder.for(&block), environment)
60
- end
61
-
62
- return environment
49
+ def self.build(...)
50
+ Environment.new(Builder.for(...))
63
51
  end
64
52
 
65
53
  def initialize(facet = ::Module.new, parent = nil)
@@ -72,6 +60,10 @@ module Async
72
60
  target.include(@facet)
73
61
  end
74
62
 
63
+ def with(...)
64
+ return self.class.new(Builder.for(...), self)
65
+ end
66
+
75
67
  # An evaluator is lazy read-only view of an environment. It memoizes all method calls.
76
68
  class Evaluator
77
69
  def self.wrap(environment)
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Service
8
- VERSION = "0.5.1"
8
+ VERSION = "0.6.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.5.1
4
+ version: 0.6.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-11 00:00:00.000000000 Z
40
+ date: 2024-03-12 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: async
metadata.gz.sig CHANGED
Binary file