async-service 0.6.0 → 0.7.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: c1a6b9d6b8b28e029a194d907ca333a9394f3cf4c0a046193ddc9825d9c415d9
4
- data.tar.gz: '082c310afc5f25e5fb053068e6b7e71facbbebc0794ec221a682edd2d069abee'
3
+ metadata.gz: 8715972e602d996a04c5d8ed36f765eab4e4eda85c5f978cd9d10b66dc48fee3
4
+ data.tar.gz: abd69a1148bcb121887aef3943a1a7fea9916d88c8d683ba25f1572a8f869bbb
5
5
  SHA512:
6
- metadata.gz: 608449e59014ab19293db0fbf67a826677d954b48c1fae24096b6984d63e5db326657bf091d696f9786406fac7bc2a78e4bd3ba0fa0bc5c02a8cbc5bc66b8b43
7
- data.tar.gz: 1ec0ba61d8afc8aa5f44408e5935717b536b30e994689bd93e10dfe4ba0db6a22b112d905aba4c95a1280b2009ff0f9e73e7eabd173e8ab6920bb05dff29e2ba
6
+ metadata.gz: 9e9618479dab469fdc62db4058a25bbe2eccbc2b1c33a6b44af7b277eaa030220cd25dd5b8d720e51b2d964ecd525d123d4d423965920d2c79b4119714a866db
7
+ data.tar.gz: c018787aef323da8805c471cc59a5a4fcbe21c83f789fbbbdd24cc37ff6c9b619f58dba04cf023390469632e72f9ccadb00498ef82f9198e50d691612e523b10
checksums.yaml.gz.sig CHANGED
Binary file
@@ -51,6 +51,10 @@ module Async
51
51
  end
52
52
 
53
53
  def initialize(facet = ::Module.new, parent = nil)
54
+ unless facet.class == ::Module
55
+ raise ArgumentError, "Facet must be a module!"
56
+ end
57
+
54
58
  @facet = facet
55
59
  @parent = parent
56
60
  end
@@ -74,16 +78,24 @@ module Async
74
78
 
75
79
  evaluator.include(facet)
76
80
 
81
+ keys = []
82
+
77
83
  # Memoize all instance methods:
78
84
  facet.instance_methods.each do |name|
79
- evaluator.define_method(name) do
80
- @cache[name] ||= super()
85
+ instance_method = facet.instance_method(name)
86
+
87
+ # Only memoize methods with no arguments:
88
+ if instance_method.arity == 0
89
+ keys << name
90
+
91
+ evaluator.define_method(name) do
92
+ @cache[name] ||= super()
93
+ end
81
94
  end
82
95
  end
83
96
 
84
- evaluator.define_method(:keys) do
85
- facet.instance_methods
86
- end
97
+ # This lists all zero-argument methods:
98
+ evaluator.define_method(:keys) {keys}
87
99
 
88
100
  return evaluator.new
89
101
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Service
8
- VERSION = "0.6.0"
8
+ VERSION = "0.7.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.6.0
4
+ version: 0.7.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-12 00:00:00.000000000 Z
40
+ date: 2024-03-17 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: async
metadata.gz.sig CHANGED
Binary file