memo_wise 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/dependency-review.yml +23 -0
- data/.github/workflows/main.yml +9 -9
- data/.gitignore +3 -0
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +217 -123
- data/Gemfile +4 -4
- data/Gemfile.lock +52 -67
- data/README.md +36 -29
- data/benchmarks/Gemfile +5 -5
- data/benchmarks/benchmarks.rb +1 -1
- data/lib/memo_wise/internal_api.rb +38 -12
- data/lib/memo_wise/version.rb +1 -1
- data/lib/memo_wise.rb +7 -6
- data/memo_wise.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07ea8ff9f5bbe537cceded02e2379f22145b2ca0023ee745cca77d503875884c
|
4
|
+
data.tar.gz: 43a1683798319eccc7fb0781519b84575c1096d938f7076b6dc5747370e5849e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d40f55683a9dd45e81ffc16ac0c4678294cf0d0668c18e676717b9146709b538a7ed9c58b6b3d75f78e262e71f27267228ee2271e47994674d32967f7ff167f
|
7
|
+
data.tar.gz: 92ad0acb0712b0cb122c77a0a8901003b79d73253adc1db8d27fedb42ec07ba49d4706ccf4be8b44a79d18856be909235ec4b4673bf576db69d7dc4643e23770
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Dependency Review Action
|
2
|
+
#
|
3
|
+
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
|
4
|
+
#
|
5
|
+
# Source repository: https://github.com/actions/dependency-review-action
|
6
|
+
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
|
7
|
+
name: 'Dependency Review'
|
8
|
+
on: [pull_request]
|
9
|
+
|
10
|
+
permissions:
|
11
|
+
contents: read
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
dependency-review:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
steps:
|
17
|
+
- name: 'Checkout Repository'
|
18
|
+
uses: actions/checkout@v4
|
19
|
+
- name: 'Dependency Review'
|
20
|
+
uses: actions/dependency-review-action@v3
|
21
|
+
with:
|
22
|
+
# Possible values: "critical", "high", "moderate", "low"
|
23
|
+
fail-on-severity: high
|
data/.github/workflows/main.yml
CHANGED
@@ -14,17 +14,17 @@ jobs:
|
|
14
14
|
matrix:
|
15
15
|
# Due to https://github.com/actions/runner/issues/849, we have to use
|
16
16
|
# quotes for '3.0' -- without quotes, CI sees '3' and runs the latest.
|
17
|
-
ruby: [2.4, 2.5, 2.6, 2.7, '3.0', 3.1, jruby, truffleruby-head]
|
17
|
+
ruby: [2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, jruby, truffleruby-head]
|
18
18
|
runs-on: ubuntu-latest
|
19
19
|
steps:
|
20
|
-
- uses: actions/checkout@
|
20
|
+
- uses: actions/checkout@v4
|
21
21
|
|
22
22
|
# Conditionally configure bundler via environment variables as advised
|
23
23
|
# * https://github.com/ruby/setup-ruby#bundle-config
|
24
24
|
- name: Set bundler environment variables
|
25
25
|
run: |
|
26
26
|
echo "BUNDLE_WITHOUT=checks:docs" >> $GITHUB_ENV
|
27
|
-
if: matrix.ruby != 3.
|
27
|
+
if: matrix.ruby != 3.2
|
28
28
|
|
29
29
|
# Use 'bundler-cache: true' instead of actions/cache as advised:
|
30
30
|
# * https://github.com/actions/cache/blob/main/examples.md#ruby---bundler
|
@@ -35,23 +35,23 @@ jobs:
|
|
35
35
|
|
36
36
|
- run: bundle exec rspec
|
37
37
|
|
38
|
-
- uses: codecov/codecov-action@
|
38
|
+
- uses: codecov/codecov-action@v3
|
39
39
|
with:
|
40
40
|
files: ./coverage/coverage.xml
|
41
41
|
fail_ci_if_error: true # optional (default = false)
|
42
42
|
verbose: true # optional (default = false)
|
43
|
-
if: matrix.ruby == 3.
|
43
|
+
if: matrix.ruby == 3.2
|
44
44
|
|
45
45
|
- run: bundle exec rubocop
|
46
|
-
if: matrix.ruby == 3.
|
46
|
+
if: matrix.ruby == 3.2
|
47
47
|
|
48
48
|
- run: |
|
49
49
|
bundle exec yard doctest
|
50
50
|
bundle exec dokaz
|
51
|
-
if: matrix.ruby == 3.
|
51
|
+
if: matrix.ruby == 3.2
|
52
52
|
|
53
|
-
- name: Run benchmarks on Ruby 2.7 or 3.
|
53
|
+
- name: Run benchmarks on Ruby 2.7 or 3.2
|
54
54
|
run: |
|
55
55
|
BUNDLE_GEMFILE=benchmarks/Gemfile bundle install --jobs 4 --retry 3
|
56
56
|
BUNDLE_GEMFILE=benchmarks/Gemfile bundle exec ruby benchmarks/benchmarks.rb
|
57
|
-
if: matrix.ruby == '2.7' || matrix.ruby == '3.
|
57
|
+
if: matrix.ruby == '2.7' || matrix.ruby == '3.2'
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1
|
1
|
+
3.2.1
|
data/CHANGELOG.md
CHANGED
@@ -1,156 +1,250 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
All notable changes to this project will be documented in this file
|
3
|
+
All notable changes to this project will be documented in this file, which
|
4
|
+
follows a format inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
4
5
|
|
5
|
-
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
-
## Unreleased
|
8
|
+
## [Unreleased](https://github.com/panorama-ed/memo_wise/compare/v1.8.0...HEAD)
|
9
9
|
|
10
|
-
|
10
|
+
**Gem enhancements:** none
|
11
11
|
|
12
|
-
|
12
|
+
_No breaking changes!_
|
13
13
|
|
14
|
-
|
14
|
+
**Project enhancements:** none
|
15
15
|
|
16
|
-
-
|
17
|
-
([#276](https://github.com/panorama-ed/memo_wise/pull/276))
|
16
|
+
## [v1.8.0](https://github.com/panorama-ed/memo_wise/compare/v1.7.0...v1.8.0) - 2023-10-25
|
18
17
|
|
19
|
-
|
18
|
+
**Gem enhancements:**
|
20
19
|
|
21
|
-
|
20
|
+
- In Ruby3.2+, for singleton classes, use `#attached_object` instead of `ObjectSpace` [[#318]](https://github.com/panorama-ed/memo_wise/pull/318)
|
22
21
|
|
23
|
-
|
24
|
-
prepends MemoWise ([#265](https://github.com/panorama-ed/memo_wise/pull/265))
|
22
|
+
_No breaking changes!_
|
25
23
|
|
26
|
-
|
24
|
+
**Project enhancements:**
|
27
25
|
|
28
|
-
-
|
26
|
+
- Switched RuboCop configuration from `panolint` to `panolint-ruby` [[#312]](https://github.com/panorama-ed/memo_wise/pull/312)
|
27
|
+
- Updated benchmark results in `README.md` to Ruby 3.2.2 and 2.7.8 [[#313]](https://github.com/panorama-ed/memo_wise/pull/297)
|
28
|
+
- Updated `Dry::Core` gem version to 1.0.0 in benchmarks [[#297]](https://github.com/panorama-ed/memo_wise/pull/297)
|
29
|
+
- Updated `Memery` gem version to 1.5.0 in benchmarks [[#313]](https://github.com/panorama-ed/memo_wise/pull/313)
|
30
|
+
- Updated `Memoized` gem version to 1.1.1 in benchmarks [[#288]](https://github.com/panorama-ed/memo_wise/pull/288)
|
31
|
+
- Reorganized `CHANGELOG.md` for improved clarity and completeness
|
32
|
+
[[#282](https://github.com/panorama-ed/memo_wise/pull/282)]
|
29
33
|
|
30
|
-
## [
|
34
|
+
## [v1.7.0](https://github.com/panorama-ed/memo_wise/compare/v1.6.0...v1.7.0) - 2022-04-04
|
31
35
|
|
32
|
-
|
36
|
+
**Gem enhancements:**
|
33
37
|
|
34
|
-
-
|
35
|
-
|
36
|
-
- Switch to a simpler internal data structure to fix several classes of bugs
|
37
|
-
related to inheritance that the previous few versions were unable to
|
38
|
-
sufficiently address
|
38
|
+
- Optimized memoized lookups for methods with multiple required arguments
|
39
|
+
[[#276](https://github.com/panorama-ed/memo_wise/pull/276)]
|
39
40
|
|
40
|
-
|
41
|
+
_No breaking changes!_
|
41
42
|
|
42
|
-
|
43
|
+
**Project enhancements:**
|
43
44
|
|
44
|
-
-
|
45
|
-
from multiple modules or a parent class ([#241](https://github.com/panorama-ed/memo_wise/pull/241))
|
45
|
+
- Added benchmarking against GitHub `main` branch to CI [[#274](https://github.com/panorama-ed/memo_wise/pull/274)]
|
46
46
|
|
47
|
-
## [
|
47
|
+
## [v1.6.0](https://github.com/panorama-ed/memo_wise/compare/v1.5.0...v1.6.0) - 2022-01-24
|
48
48
|
|
49
|
-
|
49
|
+
**Gem enhancements:**
|
50
50
|
|
51
|
-
-
|
52
|
-
|
53
|
-
- Fix bugs related to child classes inheriting from parent classes that use
|
54
|
-
`MemoWise`
|
51
|
+
- Fixed a bug relating to inheritance of classes which include a module which
|
52
|
+
`prepend`s `MemoWise` [[#262](https://github.com/panorama-ed/memo_wise/pull/262)]
|
55
53
|
|
56
|
-
|
54
|
+
_No breaking changes!_
|
57
55
|
|
58
|
-
|
59
|
-
- Improved performance of all methods by using an outer Array instead of a Hash
|
60
|
-
- Improved performance for multi-argument methods and simplify internal data
|
61
|
-
structures
|
56
|
+
**Project enhancements:**
|
62
57
|
|
63
|
-
|
64
|
-
- Removed use of #hash due to potential of hash collisions
|
65
|
-
- Updated internal local variable names to avoid name collisions with method
|
66
|
-
arguments
|
58
|
+
- Update official test coverage to support Ruby 3.1 [[#263](https://github.com/panorama-ed/memo_wise/pull/263)]
|
67
59
|
|
68
|
-
|
69
|
-
- None
|
60
|
+
## [v1.5.0](https://github.com/panorama-ed/memo_wise/compare/v1.4.0...v1.5.0) - 2021-12-17
|
70
61
|
|
71
|
-
|
72
|
-
### Updated
|
73
|
-
- Improved performance across the board by:
|
74
|
-
- removing `Hash#fetch`
|
75
|
-
- using `Array#hash`
|
76
|
-
- avoiding multi-layer hash lookups for multi-argument methods
|
77
|
-
- optimizing for truthy results
|
78
|
-
- Add `dry-core` to benchmarks in README
|
62
|
+
**Gem enhancements:**
|
79
63
|
|
80
|
-
|
81
|
-
-
|
82
|
-
-
|
64
|
+
- Removed thread-unsafe optimization which optimized for returning "truthy" results
|
65
|
+
[[#255](https://github.com/panorama-ed/memo_wise/pull/255)]
|
66
|
+
- Switched to a simpler internal data structure to fix several classes of bugs related to inheritance
|
67
|
+
that the previous few versions were unable to sufficiently address
|
68
|
+
[[#250](https://github.com/panorama-ed/memo_wise/pull/250)]
|
83
69
|
|
84
|
-
|
85
|
-
- None
|
70
|
+
_No breaking changes!_
|
86
71
|
|
87
|
-
|
88
|
-
### Added
|
89
|
-
- Support for `.preset_memo_wise` on class methods
|
90
|
-
- Support for `.reset_memo_wise` on class methods
|
72
|
+
**Project enhancements:**
|
91
73
|
|
92
|
-
|
93
|
-
- Improved performance for common cases by reducing array allocations
|
74
|
+
- Expanded thread-safety testing [[#254](https://github.com/panorama-ed/memo_wise/pull/254)]
|
94
75
|
|
95
|
-
## [0.4.0
|
96
|
-
### Added
|
97
|
-
- Documentation of confusing module test behavior
|
98
|
-
- Support using MemoWise in classes with keyword arguments in the initializer
|
99
|
-
- Support Marshal dump/load of classes using MemoWise
|
76
|
+
## [v1.4.0](https://github.com/panorama-ed/memo_wise/compare/v1.3.0...v1.4.0) - 2021-12-10
|
100
77
|
|
101
|
-
|
102
|
-
|
103
|
-
-
|
104
|
-
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
[
|
144
|
-
[
|
145
|
-
|
146
|
-
[1.
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
[
|
152
|
-
|
153
|
-
[
|
154
|
-
|
155
|
-
|
156
|
-
|
78
|
+
**Gem enhancements:**
|
79
|
+
|
80
|
+
- Fixed several bugs related to classes inheriting memoized methods from multiple modules or a parent class
|
81
|
+
[[#241](https://github.com/panorama-ed/memo_wise/pull/241)]
|
82
|
+
|
83
|
+
_No breaking changes!_
|
84
|
+
|
85
|
+
**Project enhancements:**
|
86
|
+
|
87
|
+
- Added TruffleRuby tests to CI [[#237](https://github.com/panorama-ed/memo_wise/pull/237)]
|
88
|
+
|
89
|
+
## [v1.3.0](https://github.com/panorama-ed/memo_wise/compare/v1.2.0...v1.3.0) - 2021-11-22
|
90
|
+
|
91
|
+
**Gem enhancements:**
|
92
|
+
|
93
|
+
- Fixed thread-safety issue in concurrent calls to a zero-arg method in an unmemoized state (which resulted in a `nil` value being incorrectly returned in one thread) [[#230](https://github.com/panorama-ed/memo_wise/pull/230)]
|
94
|
+
- Fixed bugs related to child classes inheriting from parent classes that use `MemoWise`
|
95
|
+
[[#229](https://github.com/panorama-ed/memo_wise/pull/229)]
|
96
|
+
|
97
|
+
_No breaking changes!_
|
98
|
+
|
99
|
+
**Project enhancements:**
|
100
|
+
|
101
|
+
- Added thread-safety test [[#225](https://github.com/panorama-ed/memo_wise/pull/225)]
|
102
|
+
|
103
|
+
## [v1.2.0](https://github.com/panorama-ed/memo_wise/compare/v1.1.0...v1.2.0) - 2021-11-10
|
104
|
+
|
105
|
+
**Gem enhancements:**
|
106
|
+
|
107
|
+
- Optimized memoized lookups for all methods by using an outer array instead of a hash
|
108
|
+
[[#211](https://github.com/panorama-ed/memo_wise/pull/211),
|
109
|
+
[#210](https://github.com/panorama-ed/memo_wise/pull/210),
|
110
|
+
[#219](https://github.com/panorama-ed/memo_wise/pull/219)]
|
111
|
+
- Removed an internal optimization using `#hash` due to the potential of hash collisions
|
112
|
+
[[#219](https://github.com/panorama-ed/memo_wise/pull/219)]
|
113
|
+
- Changed internal local variable names to avoid name collisions with memoized method arguments
|
114
|
+
[[#221](https://github.com/panorama-ed/memo_wise/pull/221)]
|
115
|
+
|
116
|
+
_No breaking changes!_
|
117
|
+
|
118
|
+
**Project enhancements:**
|
119
|
+
|
120
|
+
- Added nuance to benchmarks [[#214](https://github.com/panorama-ed/memo_wise/pull/214)]
|
121
|
+
- Significantly sped up tests [[#206](https://github.com/panorama-ed/memo_wise/pull/206)]
|
122
|
+
|
123
|
+
## [v1.1.0](https://github.com/panorama-ed/memo_wise/compare/v1.0.0...v1.1.0) - 2021-07-29
|
124
|
+
|
125
|
+
**Gem enhancements:**
|
126
|
+
|
127
|
+
- Fixed buggy behavior in module singleton classes and modules extended by other classes
|
128
|
+
[[#185](https://github.com/panorama-ed/memo_wise/pull/185)]
|
129
|
+
- Optimized memoized lookups in many cases, using a variety of optimizations
|
130
|
+
[[#189](https://github.com/panorama-ed/memo_wise/pull/189)]
|
131
|
+
|
132
|
+
_No breaking changes!_
|
133
|
+
|
134
|
+
**Project enhancements:**
|
135
|
+
|
136
|
+
- Added the `dry-core` gem to benchmarks [[#187](https://github.com/panorama-ed/memo_wise/pull/187)]
|
137
|
+
|
138
|
+
## [v1.0.0](https://github.com/panorama-ed/memo_wise/compare/v0.4.0...v1.0.0) - 2021-06-24
|
139
|
+
|
140
|
+
**Gem enhancements:**
|
141
|
+
|
142
|
+
- Class methods are now supported by `#preset_memo_wise` and `#reset_memo_wise`
|
143
|
+
[[#134](https://github.com/panorama-ed/memo_wise/pull/134),
|
144
|
+
[#145](https://github.com/panorama-ed/memo_wise/pull/145)]
|
145
|
+
- Optimized memoized lookups in many cases [[#143](https://github.com/panorama-ed/memo_wise/pull/143)]
|
146
|
+
- Implemented `.instance_method` to proxy original method parameters
|
147
|
+
[[#163](https://github.com/panorama-ed/memo_wise/pull/163)]
|
148
|
+
|
149
|
+
_No breaking changes!_
|
150
|
+
|
151
|
+
**Project enhancements:** none
|
152
|
+
|
153
|
+
## [v0.4.0](https://github.com/panorama-ed/memo_wise/compare/v0.3.0...v0.4.0) - 2021-04-30
|
154
|
+
|
155
|
+
**Gem enhancements:**
|
156
|
+
|
157
|
+
- Methods on objects that are serialized/deserialized with `Marshal` can now be memoized
|
158
|
+
[[#138](https://github.com/panorama-ed/memo_wise/pull/138)]
|
159
|
+
- Classes with keyword arguments in `#initialize` can now support memoization
|
160
|
+
[[#125](https://github.com/panorama-ed/memo_wise/pull/125)]
|
161
|
+
|
162
|
+
_No breaking changes!_
|
163
|
+
|
164
|
+
**Project enhancements:**
|
165
|
+
|
166
|
+
- Added [`A Note on Testing`](https://github.com/panorama-ed/memo_wise#a-note-on-testing) section of `README.md`
|
167
|
+
[[#123](https://github.com/panorama-ed/memo_wise/pull/123)]
|
168
|
+
|
169
|
+
## [v0.3.0](https://github.com/panorama-ed/memo_wise/compare/v0.2.0...v0.3.0) - 2021-02-11
|
170
|
+
|
171
|
+
**Gem enhancements:**
|
172
|
+
|
173
|
+
- Class methods can now be memoized [[#83](https://github.com/panorama-ed/memo_wise/pull/83)]
|
174
|
+
- Instance methods on objects created with `Class#allocate` can now be memoized
|
175
|
+
[[#99](https://github.com/panorama-ed/memo_wise/pull/99)]
|
176
|
+
- Fixed `#reset_memo_wise` for private methods [[#111](https://github.com/panorama-ed/memo_wise/pull/111)]
|
177
|
+
|
178
|
+
_No breaking changes!_
|
179
|
+
|
180
|
+
**Project enhancements:**
|
181
|
+
|
182
|
+
- Added the project logo [[#81](https://github.com/panorama-ed/memo_wise/pull/81)]
|
183
|
+
- Added `CHANGELOG.md` and version tags [[#78](https://github.com/panorama-ed/memo_wise/pull/78)]
|
184
|
+
- Documented release procedure in `README.md` [[#114](https://github.com/panorama-ed/memo_wise/pull/114)]
|
185
|
+
- Updated CI testing and benchmarks for Ruby 3.0 [[#101](https://github.com/panorama-ed/memo_wise/pull/101)]
|
186
|
+
|
187
|
+
## [v0.2.0](https://github.com/panorama-ed/memo_wise/compare/v0.1.2...v0.2.0) - 2020-10-28
|
188
|
+
|
189
|
+
**Gem enhancements:**
|
190
|
+
|
191
|
+
- Added `#preset_memo_wise` to preset memoization values [[#30](https://github.com/panorama-ed/memo_wise/pull/30)]
|
192
|
+
|
193
|
+
_Breaking changes:_
|
194
|
+
|
195
|
+
- Removed `#reset_all_memo_wise` (use `#reset_memo_wise` instead)
|
196
|
+
[[#52](https://github.com/panorama-ed/memo_wise/pull/52)]
|
197
|
+
|
198
|
+
**Project enhancements:**
|
199
|
+
|
200
|
+
- YARD docs are now generated [[#52](https://github.com/panorama-ed/memo_wise/pull/52),
|
201
|
+
[#55](https://github.com/panorama-ed/memo_wise/pull/55),
|
202
|
+
[#57](https://github.com/panorama-ed/memo_wise/pull/57)]
|
203
|
+
- 100% code coverage is now enforced [[#62](https://github.com/panorama-ed/memo_wise/pull/62)]
|
204
|
+
|
205
|
+
## [v0.1.2](https://github.com/panorama-ed/memo_wise/compare/v0.1.1...v0.1.2) - 2020-10-01
|
206
|
+
|
207
|
+
**Gem enhancements:**
|
208
|
+
|
209
|
+
- Optimized memoized lookups with internal data structure and method signature changes
|
210
|
+
[[#28](https://github.com/panorama-ed/memo_wise/pull/28), [#32](https://github.com/panorama-ed/memo_wise/pull/32)]
|
211
|
+
|
212
|
+
_No breaking changes!_
|
213
|
+
|
214
|
+
**Project enhancements:**
|
215
|
+
|
216
|
+
- Tests now assert that memoization works with the `Values` gem
|
217
|
+
[[#46](https://github.com/panorama-ed/memo_wise/pull/46)]
|
218
|
+
- Added `README.md` badges for tests, docs, and RubyGems
|
219
|
+
[[#47](https://github.com/panorama-ed/memo_wise/pull/47)]
|
220
|
+
|
221
|
+
## [v0.1.1](https://github.com/panorama-ed/memo_wise/compare/v0.1.0...v0.1.1) - 2020-08-03
|
222
|
+
|
223
|
+
**Gem enhancements:**
|
224
|
+
|
225
|
+
- `#reset_memo_wise` can now reset memoization for specific method arguments
|
226
|
+
[[#20](https://github.com/panorama-ed/memo_wise/pull/20)]
|
227
|
+
|
228
|
+
_No breaking changes!_
|
229
|
+
|
230
|
+
**Project enhancements:**
|
231
|
+
|
232
|
+
- Added benchmarks to compare `MemoWise` to other Ruby memoization gems
|
233
|
+
[[#13](https://github.com/panorama-ed/memo_wise/pull/13)]
|
234
|
+
|
235
|
+
## [v0.1.0](https://github.com/panorama-ed/memo_wise/compare/v0.0.1...v0.1.0) - 2020-07-20
|
236
|
+
|
237
|
+
**Gem enhancements:**
|
238
|
+
|
239
|
+
- Added `#memo_wise`, which enables method memoization [[#4](https://github.com/panorama-ed/memo_wise/pull/4)]
|
240
|
+
- Added `#reset_memo_wise` and `#reset_all_memo_wise`, which reset memoization
|
241
|
+
[[#4](https://github.com/panorama-ed/memo_wise/pull/4)]
|
242
|
+
|
243
|
+
_No breaking changes!_
|
244
|
+
|
245
|
+
**Project enhancements:** none
|
246
|
+
|
247
|
+
## [v0.0.1](https://github.com/panorama-ed/memo_wise/releases/tag/v0.0.1) - 2020-06-29
|
248
|
+
|
249
|
+
*This version does not provide memoization functionality; it simply includes
|
250
|
+
project scaffolding.*
|
data/Gemfile
CHANGED
@@ -7,13 +7,13 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
7
7
|
gemspec
|
8
8
|
|
9
9
|
group :test do
|
10
|
-
gem "rspec", "~> 3.
|
10
|
+
gem "rspec", "~> 3.12"
|
11
11
|
gem "values", "~> 1"
|
12
12
|
end
|
13
13
|
|
14
14
|
# Excluded from CI except on latest MRI Ruby, to reduce compatibility burden
|
15
15
|
group :checks do
|
16
|
-
gem "panolint", github: "panorama-ed/panolint", branch: "main"
|
16
|
+
gem "panolint-ruby", github: "panorama-ed/panolint-ruby", branch: "main"
|
17
17
|
|
18
18
|
# Simplecov to generate coverage info
|
19
19
|
gem "simplecov", require: false
|
@@ -24,8 +24,8 @@ end
|
|
24
24
|
|
25
25
|
# Excluded from CI except on latest MRI Ruby, to reduce compatibility burden
|
26
26
|
group :docs do
|
27
|
-
gem "dokaz"
|
28
|
-
gem "redcarpet", "~> 3.
|
27
|
+
gem "dokaz", "~> 0.0.5"
|
28
|
+
gem "redcarpet", "~> 3.6"
|
29
29
|
gem "yard", "~> 0.9"
|
30
30
|
gem "yard-doctest", "~> 0.1"
|
31
31
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,89 +1,78 @@
|
|
1
1
|
GIT
|
2
|
-
remote: https://github.com/panorama-ed/panolint.git
|
3
|
-
revision:
|
2
|
+
remote: https://github.com/panorama-ed/panolint-ruby.git
|
3
|
+
revision: a93988ea554177cf0ec9ef636c442f9d3af49a10
|
4
4
|
branch: main
|
5
5
|
specs:
|
6
|
-
panolint (0
|
7
|
-
|
8
|
-
rubocop (
|
9
|
-
rubocop-
|
10
|
-
rubocop-rails (~> 2.5)
|
11
|
-
rubocop-rake (~> 0.5)
|
12
|
-
rubocop-rspec (~> 2.0)
|
6
|
+
panolint-ruby (0)
|
7
|
+
rubocop (= 1.51.0)
|
8
|
+
rubocop-performance (= 1.18.0)
|
9
|
+
rubocop-rspec (= 2.22.0)
|
13
10
|
|
14
11
|
PATH
|
15
12
|
remote: .
|
16
13
|
specs:
|
17
|
-
memo_wise (1.
|
14
|
+
memo_wise (1.8.0)
|
18
15
|
|
19
16
|
GEM
|
20
17
|
remote: https://rubygems.org/
|
21
18
|
specs:
|
22
|
-
activesupport (7.0.2.2)
|
23
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
|
-
i18n (>= 1.6, < 2)
|
25
|
-
minitest (>= 5.1)
|
26
|
-
tzinfo (~> 2.0)
|
27
19
|
ansi (1.5.0)
|
28
20
|
ast (2.4.2)
|
29
|
-
brakeman (5.2.1)
|
30
|
-
concurrent-ruby (1.1.9)
|
31
21
|
diff-lcs (1.5.0)
|
32
22
|
docile (1.4.0)
|
33
|
-
dokaz (0.0.
|
23
|
+
dokaz (0.0.5)
|
34
24
|
ansi
|
35
|
-
rouge
|
25
|
+
rouge (~> 4)
|
36
26
|
slop (~> 3)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
parser (3.1.1.0)
|
27
|
+
json (2.6.3)
|
28
|
+
minitest (5.18.0)
|
29
|
+
parallel (1.23.0)
|
30
|
+
parser (3.2.2.1)
|
42
31
|
ast (~> 2.4.1)
|
43
|
-
rack (2.2.3)
|
44
32
|
rainbow (3.1.1)
|
45
33
|
rake (13.0.6)
|
46
|
-
redcarpet (3.
|
47
|
-
regexp_parser (2.
|
34
|
+
redcarpet (3.6.0)
|
35
|
+
regexp_parser (2.8.0)
|
48
36
|
rexml (3.2.5)
|
49
|
-
rouge (
|
50
|
-
rspec (3.
|
51
|
-
rspec-core (~> 3.
|
52
|
-
rspec-expectations (~> 3.
|
53
|
-
rspec-mocks (~> 3.
|
54
|
-
rspec-core (3.
|
55
|
-
rspec-support (~> 3.
|
56
|
-
rspec-expectations (3.
|
37
|
+
rouge (4.1.0)
|
38
|
+
rspec (3.12.0)
|
39
|
+
rspec-core (~> 3.12.0)
|
40
|
+
rspec-expectations (~> 3.12.0)
|
41
|
+
rspec-mocks (~> 3.12.0)
|
42
|
+
rspec-core (3.12.1)
|
43
|
+
rspec-support (~> 3.12.0)
|
44
|
+
rspec-expectations (3.12.2)
|
57
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
|
-
rspec-support (~> 3.
|
59
|
-
rspec-mocks (3.
|
46
|
+
rspec-support (~> 3.12.0)
|
47
|
+
rspec-mocks (3.12.3)
|
60
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
|
-
rspec-support (~> 3.
|
62
|
-
rspec-support (3.
|
63
|
-
rubocop (1.
|
49
|
+
rspec-support (~> 3.12.0)
|
50
|
+
rspec-support (3.12.0)
|
51
|
+
rubocop (1.51.0)
|
52
|
+
json (~> 2.3)
|
64
53
|
parallel (~> 1.10)
|
65
|
-
parser (>= 3.
|
54
|
+
parser (>= 3.2.0.0)
|
66
55
|
rainbow (>= 2.2.2, < 4.0)
|
67
56
|
regexp_parser (>= 1.8, < 3.0)
|
68
|
-
rexml
|
69
|
-
rubocop-ast (>= 1.
|
57
|
+
rexml (>= 3.2.5, < 4.0)
|
58
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
70
59
|
ruby-progressbar (~> 1.7)
|
71
|
-
unicode-display_width (>=
|
72
|
-
rubocop-ast (1.
|
73
|
-
parser (>= 3.
|
74
|
-
rubocop-
|
60
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
61
|
+
rubocop-ast (1.28.1)
|
62
|
+
parser (>= 3.2.1.0)
|
63
|
+
rubocop-capybara (2.18.0)
|
64
|
+
rubocop (~> 1.41)
|
65
|
+
rubocop-factory_bot (2.23.1)
|
66
|
+
rubocop (~> 1.33)
|
67
|
+
rubocop-performance (1.18.0)
|
75
68
|
rubocop (>= 1.7.0, < 2.0)
|
76
69
|
rubocop-ast (>= 0.4.0)
|
77
|
-
rubocop-
|
78
|
-
|
79
|
-
|
80
|
-
rubocop (
|
81
|
-
|
82
|
-
|
83
|
-
rubocop-rspec (2.9.0)
|
84
|
-
rubocop (~> 1.19)
|
85
|
-
ruby-progressbar (1.11.0)
|
86
|
-
simplecov (0.21.2)
|
70
|
+
rubocop-rspec (2.22.0)
|
71
|
+
rubocop (~> 1.33)
|
72
|
+
rubocop-capybara (~> 2.17)
|
73
|
+
rubocop-factory_bot (~> 2.22)
|
74
|
+
ruby-progressbar (1.13.0)
|
75
|
+
simplecov (0.22.0)
|
87
76
|
docile (~> 1.1)
|
88
77
|
simplecov-html (~> 0.11)
|
89
78
|
simplecov_json_formatter (~> 0.1)
|
@@ -93,13 +82,9 @@ GEM
|
|
93
82
|
simplecov-html (0.12.3)
|
94
83
|
simplecov_json_formatter (0.1.4)
|
95
84
|
slop (3.6.0)
|
96
|
-
|
97
|
-
concurrent-ruby (~> 1.0)
|
98
|
-
unicode-display_width (2.1.0)
|
85
|
+
unicode-display_width (2.4.2)
|
99
86
|
values (1.8.0)
|
100
|
-
|
101
|
-
yard (0.9.27)
|
102
|
-
webrick (~> 1.7.0)
|
87
|
+
yard (0.9.34)
|
103
88
|
yard-doctest (0.1.17)
|
104
89
|
minitest
|
105
90
|
yard
|
@@ -108,12 +93,12 @@ PLATFORMS
|
|
108
93
|
ruby
|
109
94
|
|
110
95
|
DEPENDENCIES
|
111
|
-
dokaz
|
96
|
+
dokaz (~> 0.0.5)
|
112
97
|
memo_wise!
|
113
|
-
panolint!
|
98
|
+
panolint-ruby!
|
114
99
|
rake
|
115
|
-
redcarpet (~> 3.
|
116
|
-
rspec (~> 3.
|
100
|
+
redcarpet (~> 3.6)
|
101
|
+
rspec (~> 3.12)
|
117
102
|
simplecov
|
118
103
|
simplecov-cobertura
|
119
104
|
values (~> 1)
|
data/README.md
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
# `MemoWise`
|
7
7
|
|
8
8
|
[![Tests](https://github.com/panorama-ed/memo_wise/workflows/Main/badge.svg)](https://github.com/panorama-ed/memo_wise/actions?query=workflow%3AMain)
|
9
|
-
[![Code Coverage](https://codecov.io/gh/panorama-ed/memo_wise/branch/main/graph/badge.svg)](https://codecov.io/gh/panorama-ed/memo_wise
|
10
|
-
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/
|
9
|
+
[![Code Coverage](https://codecov.io/gh/panorama-ed/memo_wise/branch/main/graph/badge.svg)](https://codecov.io/gh/panorama-ed/memo_wise)
|
10
|
+
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/gems/memo_wise)
|
11
11
|
[![Gem Version](https://img.shields.io/gem/v/memo_wise.svg)](https://rubygems.org/gems/memo_wise)
|
12
12
|
[![Gem Downloads](https://img.shields.io/gem/dt/memo_wise.svg)](https://rubygems.org/gems/memo_wise)
|
13
13
|
|
@@ -112,38 +112,38 @@ For more usage details, see our detailed [documentation](#documentation).
|
|
112
112
|
|
113
113
|
## Benchmarks
|
114
114
|
|
115
|
-
Benchmarks are run in GitHub Actions, and the tables below are updated with every code change. **Values >1.00x represent how much _slower_ each gem’s memoized value retrieval is than the latest commit of `MemoWise`**, according to [`benchmark-ips`](https://github.com/evanphx/benchmark-ips) (2.
|
115
|
+
Benchmarks are run in GitHub Actions, and the tables below are updated with every code change. **Values >1.00x represent how much _slower_ each gem’s memoized value retrieval is than the latest commit of `MemoWise`**, according to [`benchmark-ips`](https://github.com/evanphx/benchmark-ips) (2.11.0).
|
116
116
|
|
117
|
-
Results using Ruby 3.
|
117
|
+
Results using Ruby 3.2.2:
|
118
118
|
|
119
|
-
|Method arguments|`Dry::Core`\* (0.
|
119
|
+
|Method arguments|`Dry::Core`\* (1.0.1)|`Memery` (1.5.0)|
|
120
120
|
|--|--|--|
|
121
|
-
|`()` (none)|
|
122
|
-
|`(a)`|1.
|
123
|
-
|`(a, b)`|1.
|
124
|
-
|`(a:)`|1.
|
125
|
-
|`(a:, b:)`|1.
|
126
|
-
|`(a, b:)`|1.
|
127
|
-
|`(a, *args)`|0.
|
128
|
-
|`(a:, **kwargs)`|0.
|
129
|
-
|`(a, *args, b:, **kwargs)`|0.
|
121
|
+
|`()` (none)|0.54x|3.62x|
|
122
|
+
|`(a)`|1.54x|7.74x|
|
123
|
+
|`(a, b)`|1.29x|5.58x|
|
124
|
+
|`(a:)`|1.55x|12.37x|
|
125
|
+
|`(a:, b:)`|1.15x|8.76x|
|
126
|
+
|`(a, b:)`|1.15x|8.75x|
|
127
|
+
|`(a, *args)`|0.84x|1.54x|
|
128
|
+
|`(a:, **kwargs)`|0.79x|2.13x|
|
129
|
+
|`(a, *args, b:, **kwargs)`|0.69x|1.38x|
|
130
130
|
|
131
131
|
\* `Dry::Core`
|
132
132
|
[may cause incorrect behavior caused by hash collisions](https://github.com/dry-rb/dry-core/issues/63).
|
133
133
|
|
134
|
-
Results using Ruby 2.7.
|
134
|
+
Results using Ruby 2.7.8 (because these gems raise errors in Ruby 3.x):
|
135
135
|
|
136
|
-
|Method arguments|`DDMemoize` (1.0.0)|`Memoist` (0.16.2)|`Memoized` (1.
|
136
|
+
|Method arguments|`DDMemoize` (1.0.0)|`Memoist` (0.16.2)|`Memoized` (1.1.1)|`Memoizer` (1.0.3)|
|
137
137
|
|--|--|--|--|--|
|
138
|
-
|`()` (none)|24.22x|2.
|
139
|
-
|`(a)`|
|
140
|
-
|`(a, b)`|
|
141
|
-
|`(a:)`|
|
142
|
-
|`(a:, b:)`|
|
143
|
-
|`(a, b:)`|
|
144
|
-
|`(a, *args)`|3.
|
145
|
-
|`(a:, **kwargs)`|2.
|
146
|
-
|`(a, *args, b:, **kwargs)`|2.
|
138
|
+
|`()` (none)|24.22x|2.42x|26.43x|2.70x|
|
139
|
+
|`(a)`|22.08x|15.19x|22.03x|13.67x|
|
140
|
+
|`(a, b)`|19.12x|14.01x|18.60x|12.80x|
|
141
|
+
|`(a:)`|30.21x|24.29x|26.43x|23.11x|
|
142
|
+
|`(a:, b:)`|27.73x|22.97x|25.11x|21.89x|
|
143
|
+
|`(a, b:)`|26.87x|22.76x|23.71x|21.26x|
|
144
|
+
|`(a, *args)`|3.15x|2.30x|3.18x|2.11x|
|
145
|
+
|`(a:, **kwargs)`|2.89x|2.40x|2.69x|2.28x|
|
146
|
+
|`(a, *args, b:, **kwargs)`|2.12x|1.82x|1.96x|1.74x|
|
147
147
|
|
148
148
|
You can run benchmarks yourself with:
|
149
149
|
|
@@ -180,7 +180,7 @@ versions:
|
|
180
180
|
|
181
181
|
We maintain API documentation using [YARD](https://yardoc.org/), which is
|
182
182
|
published automatically at
|
183
|
-
[RubyDoc.info](https://rubydoc.info/
|
183
|
+
[RubyDoc.info](https://rubydoc.info/gems/memo_wise). To
|
184
184
|
edit documentation locally and see it rendered in your browser, run:
|
185
185
|
|
186
186
|
```bash
|
@@ -235,7 +235,7 @@ And we've written more about `MemoWise` in a series of blog posts:
|
|
235
235
|
|
236
236
|
- [Introducing: MemoWise](https://medium.com/building-panorama-education/introducing-memowise-51a5f0523489)
|
237
237
|
- [Optimizing MemoWise Performance](https://ja.cob.land/optimizing-memowise-performance)
|
238
|
-
- [
|
238
|
+
- [Esoteric Ruby in MemoWise](https://jemma.dev/blog/esoteric-ruby-in-memowise)
|
239
239
|
|
240
240
|
## Logo
|
241
241
|
|
@@ -266,9 +266,16 @@ Then carry out these steps:
|
|
266
266
|
|
267
267
|
1. Update `CHANGELOG.md`:
|
268
268
|
- Add an entry for the upcoming version _x.y.z_
|
269
|
-
- Add a link for this version's comparison to the bottom of `CHANGELOG.md`
|
270
269
|
- Move content from _Unreleased_ to the upcoming version _x.y.z_
|
271
|
-
-
|
270
|
+
- Update the diff links for this version and _Unreleased_ in `CHANGELOG.md`
|
271
|
+
- Change _Unreleased_ section to say:
|
272
|
+
```
|
273
|
+
**Gem enhancements:** none
|
274
|
+
|
275
|
+
_No breaking changes!_
|
276
|
+
|
277
|
+
**Project enhancements:** none
|
278
|
+
```
|
272
279
|
- Commit with title `Update CHANGELOG.md for x.y.z`
|
273
280
|
|
274
281
|
2. Update `lib/memo_wise/version.rb`
|
data/benchmarks/Gemfile
CHANGED
@@ -4,17 +4,17 @@ source "https://rubygems.org"
|
|
4
4
|
|
5
5
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
6
6
|
|
7
|
-
ruby ">= 2.7.
|
7
|
+
ruby ">= 2.7.7"
|
8
8
|
|
9
|
-
gem "benchmark-ips", "2.
|
9
|
+
gem "benchmark-ips", "2.12.0"
|
10
10
|
|
11
11
|
if RUBY_VERSION > "3"
|
12
|
-
gem "dry-core", "0.
|
13
|
-
gem "memery", "1.
|
12
|
+
gem "dry-core", "1.0.1"
|
13
|
+
gem "memery", "1.5.0"
|
14
14
|
else
|
15
15
|
gem "ddmemoize", "1.0.0"
|
16
16
|
gem "memoist", "0.16.2"
|
17
|
-
gem "memoized", "1.
|
17
|
+
gem "memoized", "1.1.1"
|
18
18
|
gem "memoizer", "1.0.3"
|
19
19
|
end
|
20
20
|
|
data/benchmarks/benchmarks.rb
CHANGED
@@ -211,7 +211,7 @@ benchmark_jsons = benchmark_lambdas.map do |benchmark|
|
|
211
211
|
json_file = Tempfile.new
|
212
212
|
|
213
213
|
Benchmark.ips do |x|
|
214
|
-
x.config(suite: suite)
|
214
|
+
x.config(suite: suite)
|
215
215
|
BENCHMARK_GEMS.each do |benchmark_gem|
|
216
216
|
instance = Object.const_get("#{benchmark_gem.klass}Example").new
|
217
217
|
|
@@ -126,18 +126,7 @@ module MemoWise
|
|
126
126
|
def self.original_class_from_singleton(klass)
|
127
127
|
raise ArgumentError, "Must be a singleton class: #{klass.inspect}" unless klass.singleton_class?
|
128
128
|
|
129
|
-
|
130
|
-
# huge impact; for example, in our test suite this drops our test times
|
131
|
-
# from over five minutes to just a few seconds.
|
132
|
-
@original_class_from_singleton ||= {}
|
133
|
-
|
134
|
-
# Search ObjectSpace
|
135
|
-
# * 1:1 relationship of singleton class to original class is documented
|
136
|
-
# * Performance concern: searches all Class objects
|
137
|
-
# But, only runs at load time and results are memoized
|
138
|
-
@original_class_from_singleton[klass] ||= ObjectSpace.each_object(Module).find do |cls|
|
139
|
-
cls.singleton_class == klass
|
140
|
-
end
|
129
|
+
find_attached_object(klass)
|
141
130
|
end
|
142
131
|
|
143
132
|
# Convention we use for renaming the original method when we replace with
|
@@ -208,5 +197,42 @@ module MemoWise
|
|
208
197
|
end
|
209
198
|
end
|
210
199
|
private_class_method :target_class
|
200
|
+
|
201
|
+
if Module.singleton_class.respond_to?(:attached_object)
|
202
|
+
# In Ruby3.2+, for singleton classes, `#attached_object` returns the object this class is for
|
203
|
+
# https://bugs.ruby-lang.org/issues/12084
|
204
|
+
#
|
205
|
+
# @param klass [Class]
|
206
|
+
# Singleton class to find the original class of
|
207
|
+
#
|
208
|
+
# @return Class
|
209
|
+
# Original class for which `klass` is the singleton class.
|
210
|
+
def self.find_attached_object(klass)
|
211
|
+
klass.attached_object
|
212
|
+
end
|
213
|
+
else
|
214
|
+
# :nocov:
|
215
|
+
# @param klass [Class]
|
216
|
+
# Singleton class to find the original class of
|
217
|
+
#
|
218
|
+
# @return Class
|
219
|
+
# Original class for which `klass` is the singleton class.
|
220
|
+
def self.find_attached_object(klass)
|
221
|
+
# Since we call this method a lot, we memoize the results. This can have a
|
222
|
+
# huge impact; for example, in our test suite this drops our test times
|
223
|
+
# from over five minutes to just a few seconds.
|
224
|
+
@original_class_from_singleton ||= {}
|
225
|
+
|
226
|
+
# Search ObjectSpace
|
227
|
+
# * 1:1 relationship of singleton class to original class is documented
|
228
|
+
# * Performance concern: searches all Class objects
|
229
|
+
# But, only runs at load time and results are memoized
|
230
|
+
@original_class_from_singleton[klass] ||= ObjectSpace.each_object(Module).find do |cls|
|
231
|
+
cls.singleton_class == klass
|
232
|
+
end
|
233
|
+
end
|
234
|
+
# :nocov:
|
235
|
+
end
|
236
|
+
private_class_method :find_attached_object
|
211
237
|
end
|
212
238
|
end
|
data/lib/memo_wise/version.rb
CHANGED
data/lib/memo_wise.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
# Disable RuboCop here because Ruby < 3.2 does not load `set` by default.
|
4
|
+
require "set" # rubocop:disable Lint/RedundantRequireStatement
|
4
5
|
|
5
6
|
require "memo_wise/internal_api"
|
6
7
|
require "memo_wise/version"
|
@@ -30,12 +31,12 @@ module MemoWise
|
|
30
31
|
# [calling the original](https://medium.com/@jeremy_96642/ruby-method-auditing-using-module-prepend-4f4e69aacd95)
|
31
32
|
# constructor.
|
32
33
|
#
|
33
|
-
# - **Q:** Why is [Module#prepend](https://ruby-doc.org/
|
34
|
+
# - **Q:** Why is [Module#prepend](https://ruby-doc.org/3.2.1/Module.html#method-i-prepend)
|
34
35
|
# important here
|
35
36
|
# ([more info](https://medium.com/@leo_hetsch/ruby-modules-include-vs-prepend-vs-extend-f09837a5b073))?
|
36
37
|
# - **A:** To set up *mutable state* inside the instance, even if the original
|
37
38
|
# constructor will then call
|
38
|
-
# [Object#freeze](https://ruby-doc.org/
|
39
|
+
# [Object#freeze](https://ruby-doc.org/3.2.1/Object.html#method-i-freeze).
|
39
40
|
#
|
40
41
|
# This approach supports memoization on frozen (immutable) objects -- for
|
41
42
|
# example, classes created by the
|
@@ -84,7 +85,7 @@ module MemoWise
|
|
84
85
|
# @param target [Class]
|
85
86
|
# The `Class` into to prepend the MemoWise methods e.g. `memo_wise`
|
86
87
|
#
|
87
|
-
# @see https://ruby-doc.org/
|
88
|
+
# @see https://ruby-doc.org/3.2.1/Module.html#method-i-prepend
|
88
89
|
#
|
89
90
|
# @example
|
90
91
|
# class Example
|
@@ -99,7 +100,7 @@ module MemoWise
|
|
99
100
|
#
|
100
101
|
# This is necessary in addition to the `#initialize` method definition
|
101
102
|
# above because
|
102
|
-
# [`Class#allocate`](https://ruby-doc.org/
|
103
|
+
# [`Class#allocate`](https://ruby-doc.org/3.2.1/Class.html#method-i-allocate)
|
103
104
|
# bypasses `#initialize`, and when it's used (e.g.,
|
104
105
|
# [in ActiveRecord](https://github.com/rails/rails/blob/a395c3a6af1e079740e7a28994d77c8baadd2a9d/activerecord/lib/active_record/persistence.rb#L411))
|
105
106
|
# we still need to be able to access MemoWise's instance variable. Despite
|
@@ -254,7 +255,7 @@ module MemoWise
|
|
254
255
|
)
|
255
256
|
end
|
256
257
|
|
257
|
-
# Override [Module#instance_method](https://ruby-doc.org/
|
258
|
+
# Override [Module#instance_method](https://ruby-doc.org/3.2.1/Module.html#method-i-instance_method)
|
258
259
|
# to proxy the original `UnboundMethod#parameters` results. We want the
|
259
260
|
# parameters to reflect the original method in order to support callers
|
260
261
|
# who want to use Ruby reflection to process the method parameters,
|
data/memo_wise.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative "lib/memo_wise/version"
|
4
4
|
|
5
|
-
Gem::Specification.new do |spec|
|
5
|
+
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "memo_wise"
|
7
7
|
spec.version = MemoWise::VERSION
|
8
8
|
spec.summary = "The wise choice for Ruby memoization"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memo_wise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Panorama Education
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-10-30 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description:
|
17
17
|
email:
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- ".dokaz"
|
27
27
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
28
28
|
- ".github/dependabot.yml"
|
29
|
+
- ".github/workflows/dependency-review.yml"
|
29
30
|
- ".github/workflows/main.yml"
|
30
31
|
- ".gitignore"
|
31
32
|
- ".rspec"
|
@@ -70,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
71
|
- !ruby/object:Gem::Version
|
71
72
|
version: '0'
|
72
73
|
requirements: []
|
73
|
-
rubygems_version: 3.
|
74
|
+
rubygems_version: 3.4.6
|
74
75
|
signing_key:
|
75
76
|
specification_version: 4
|
76
77
|
summary: The wise choice for Ruby memoization
|