short_circu_it 0.6.0.pre3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/short_circu_it/version.rb +1 -1
- data/lib/short_circu_it.rb +9 -4
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 929f965c27fd65d81404dd6679b49e22144b2c30eda2d70c5366c330f4267cac
|
4
|
+
data.tar.gz: 206cee4f666cadbd83a4e6d6286079a79602b1457462395db3d5ce432329d150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a018ad63e0ec41ada2a01d06dd6333a553e8da83c836efbd36aae53d69a7bd478b508c4953eed2da5a07ec85d4a521696a374a44a4939a1976884e432d0bb07
|
7
|
+
data.tar.gz: 6cbfbf5e216586bc9928903b88fdfceb1dc0851d122c096568dea8c67f74509f3c6db3b50ceeb8675492d82690b88697ee0532921df5ac503e8acda6cbc629d1
|
data/lib/short_circu_it.rb
CHANGED
@@ -26,8 +26,9 @@ module ShortCircuIt
|
|
26
26
|
|
27
27
|
class_methods do
|
28
28
|
def memoization_observers
|
29
|
-
|
30
|
-
|
29
|
+
return _memoization_observers unless superclass.respond_to?(:memoization_observers)
|
30
|
+
|
31
|
+
superclass.memoization_observers.merge(_memoization_observers)
|
31
32
|
end
|
32
33
|
|
33
34
|
protected
|
@@ -87,11 +88,15 @@ module ShortCircuIt
|
|
87
88
|
|
88
89
|
private
|
89
90
|
|
90
|
-
attr_writer :
|
91
|
+
attr_writer :_memoization_observers
|
92
|
+
|
93
|
+
def _memoization_observers
|
94
|
+
@_memoization_observers ||= {}
|
95
|
+
end
|
91
96
|
|
92
97
|
def add_memoized_observers(method_name, observers)
|
93
98
|
# TODO: Raise an error if method has already been memoized? A warning maybe?
|
94
|
-
self.
|
99
|
+
self._memoization_observers = _memoization_observers.
|
95
100
|
merge(method_name.to_sym => Array.wrap(observers).freeze).
|
96
101
|
freeze
|
97
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: short_circu_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.0
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allen Rettberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.6.0
|
33
|
+
version: 0.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.6.0
|
40
|
+
version: 0.6.0
|
41
41
|
description: Memoize methods safely with parameter and dependency observation
|
42
42
|
email:
|
43
43
|
- allen.rettberg@freshly.com
|
@@ -66,11 +66,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
66
|
version: '0'
|
67
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- - "
|
69
|
+
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
71
|
+
version: '0'
|
72
72
|
requirements: []
|
73
|
-
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.7.6
|
74
75
|
signing_key:
|
75
76
|
specification_version: 4
|
76
77
|
summary: Effortless memoization
|