memo_wise 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -5
- data/README.md +15 -29
- data/lib/memo_wise/version.rb +1 -1
- data/lib/memo_wise.rb +11 -34
- metadata +4 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5a910792fbcb5c44a6b7e82d8c62b4c11c64fef9d59ac79a326a34e8fde9b87
|
4
|
+
data.tar.gz: b00093fd37b3f9ff175d41db4eafde58b6af04037f07b1c02328e1aab84d674b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e93861cd450870d06793d72a19452354a983f0a2211e65086d699cb3b6c710b9d34e52bf7afa3a4e26a60e831fea9cc8b7596324f4daae83d1af84dfa9095a5
|
7
|
+
data.tar.gz: 49855e1a33e75516493a7d6ddb89b22d5856e4a8f86ccdf32ace6adde03a1873e49e504ece5d2c10122d4eeff09967257495732006e00f8d1f01966096572e8f
|
data/CHANGELOG.md
CHANGED
@@ -5,7 +5,7 @@ follows a format inspired by [Keep a Changelog](https://keepachangelog.com/en/1.
|
|
5
5
|
|
6
6
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
-
## [Unreleased](https://github.com/panorama-ed/memo_wise/compare/v1.
|
8
|
+
## [Unreleased](https://github.com/panorama-ed/memo_wise/compare/v1.12.0...HEAD)
|
9
9
|
|
10
10
|
**Gem enhancements:** none
|
11
11
|
|
@@ -13,6 +13,22 @@ _No breaking changes!_
|
|
13
13
|
|
14
14
|
**Project enhancements:** none
|
15
15
|
|
16
|
+
## [v1.12.0](https://github.com/panorama-ed/memo_wise/compare/v1.11.0...v1.12.0)
|
17
|
+
|
18
|
+
**Gem enhancements:** none
|
19
|
+
|
20
|
+
- Allowed memoization when `include`d modules `prepend MemoWise` and define `initialize` [[#327]](https://github.com/panorama-ed/memo_wise/pull/327)
|
21
|
+
|
22
|
+
_Breaking changes:_
|
23
|
+
- Removed Ruby 2.7 (EOL) and 3.0 (EOL) support to allow enhancement noted above [[#327]](https://github.com/panorama-ed/memo_wise/pull/327)
|
24
|
+
|
25
|
+
**Project enhancements:**
|
26
|
+
|
27
|
+
- Updated official test coverage to support Ruby 3.4 [[#335](https://github.com/panorama-ed/memo_wise/pull/335)]
|
28
|
+
- Updated `memery` gem version to 1.7.0 in benchmarks [[#380](https://github.com/panorama-ed/memo_wise/pull/380)]
|
29
|
+
- Added `short_circu_it` gem to benchmarks [[#384](https://github.com/panorama-ed/memo_wise/pull/384)]
|
30
|
+
- Increased benchmark warmup time to reduce warmup artifacts when benchmarking locally [[#355](https://github.com/panorama-ed/memo_wise/pull/355)]
|
31
|
+
|
16
32
|
## [v1.11.0](https://github.com/panorama-ed/memo_wise/compare/v1.10.0...v1.11.0)
|
17
33
|
|
18
34
|
**Gem enhancements:**
|
@@ -40,6 +56,7 @@ _No breaking changes!_
|
|
40
56
|
|
41
57
|
- Updated official test coverage to support Ruby 3.3 [[#335](https://github.com/panorama-ed/memo_wise/pull/335)]
|
42
58
|
- Added `alt_memery` and `memoist3` to benchmarks [[#339](https://github.com/panorama-ed/memo_wise/pull/339)]
|
59
|
+
- Updated `memery` gem version to 1.6.0 in benchmarks [[#339](https://github.com/panorama-ed/memo_wise/pull/339)]
|
43
60
|
- Updated benchmark results in `README.md` to Ruby 3.3.5 [[#339](https://github.com/panorama-ed/memo_wise/pull/339)]
|
44
61
|
|
45
62
|
## [v1.9.0](https://github.com/panorama-ed/memo_wise/compare/v1.8.0...v1.9.0)
|
@@ -69,9 +86,9 @@ _No breaking changes!_
|
|
69
86
|
|
70
87
|
- Switched RuboCop configuration from `panolint` to `panolint-ruby` [[#312](https://github.com/panorama-ed/memo_wise/pull/312)]
|
71
88
|
- 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)]
|
72
|
-
- Updated `
|
73
|
-
- Updated `
|
74
|
-
- Updated `
|
89
|
+
- Updated `dry-core` gem version to 1.0.0 in benchmarks [[#297](https://github.com/panorama-ed/memo_wise/pull/297)]
|
90
|
+
- Updated `memery` gem version to 1.5.0 in benchmarks [[#313](https://github.com/panorama-ed/memo_wise/pull/313)]
|
91
|
+
- Updated `memoized` gem version to 1.1.1 in benchmarks [[#288](https://github.com/panorama-ed/memo_wise/pull/288)]
|
75
92
|
- Reorganized `CHANGELOG.md` for improved clarity and completeness [[#282](https://github.com/panorama-ed/memo_wise/pull/282)]
|
76
93
|
|
77
94
|
## [v1.7.0](https://github.com/panorama-ed/memo_wise/compare/v1.6.0...v1.7.0) - 2022-04-04
|
@@ -256,7 +273,7 @@ _No breaking changes!_
|
|
256
273
|
|
257
274
|
**Project enhancements:**
|
258
275
|
|
259
|
-
- Tests now assert that memoization works with the `
|
276
|
+
- Tests now assert that memoization works with the `values` gem
|
260
277
|
[[#46](https://github.com/panorama-ed/memo_wise/pull/46)]
|
261
278
|
- Added `README.md` badges for tests, docs, and RubyGems
|
262
279
|
[[#47](https://github.com/panorama-ed/memo_wise/pull/47)]
|
data/README.md
CHANGED
@@ -114,37 +114,23 @@ For more usage details, see our detailed [documentation](#documentation).
|
|
114
114
|
|
115
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.14.0).
|
116
116
|
|
117
|
-
Results using Ruby 3.3
|
118
|
-
|
119
|
-
|Method arguments|`alt_memery` (2.1.0)|`dry-core`\* (1.0
|
120
|
-
|
121
|
-
|`()` (none)|12.
|
122
|
-
|`(a)`|9.
|
123
|
-
|`(a, b)`|7.
|
124
|
-
|`(a:)`|
|
125
|
-
|`(a:, b:)`|
|
126
|
-
|`(a, b:)`|
|
127
|
-
|`(a, *args)`|1.
|
128
|
-
|`(a:, **kwargs)`|2.
|
129
|
-
|`(a, *args, b:, **kwargs)`|1.
|
117
|
+
Results using Ruby 3.4.3:
|
118
|
+
|
119
|
+
|Method arguments|`alt_memery` (2.1.0)|`dry-core`\* (1.1.0)|`memery` (1.7.0)|`memoist3` (1.0.0)|`short_circu_it` (0.29.3)|
|
120
|
+
|--|--|--|--|--|--|
|
121
|
+
|`()` (none)|12.27x|0.58x|3.36x|2.79x|18.43x|
|
122
|
+
|`(a)`|9.50x|0.99x|3.79x|14.93x|14.16x|
|
123
|
+
|`(a, b)`|7.51x|0.83x|2.96x|11.84x|11.19x|
|
124
|
+
|`(a:)`|14.32x|1.00x|6.46x|19.60x|12.81x|
|
125
|
+
|`(a:, b:)`|12.24x|0.86x|5.56x|20.89x|10.78x|
|
126
|
+
|`(a, b:)`|11.98x|0.85x|5.42x|16.25x|10.76x|
|
127
|
+
|`(a, *args)`|1.91x|0.66x|0.75x|2.96x|2.80x|
|
128
|
+
|`(a:, **kwargs)`|2.73x|0.71x|1.22x|4.69x|2.41x|
|
129
|
+
|`(a, *args, b:, **kwargs)`|1.76x|0.63x|0.84x|3.00x|1.52x|
|
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.8 (because these gems raise errors in Ruby 3.x):
|
135
|
-
|
136
|
-
|Method arguments|`ddmemoize` (1.0.0)|`memoist` (0.16.2)|`memoized` (1.1.1)|`memoizer` (1.0.3)|
|
137
|
-
|--|--|--|--|--|
|
138
|
-
|`()` (none)|24.14x|2.44x|23.84x|2.59x|
|
139
|
-
|`(a)`|22.16x|14.80x|20.70x|11.67x|
|
140
|
-
|`(a, b)`|19.39x|13.66x|18.03x|11.46x|
|
141
|
-
|`(a:)`|30.54x|23.68x|25.21x|21.20x|
|
142
|
-
|`(a:, b:)`|27.75x|22.59x|23.47x|20.65x|
|
143
|
-
|`(a, b:)`|26.72x|21.39x|21.73x|19.43x|
|
144
|
-
|`(a, *args)`|3.26x|2.31x|3.09x|1.93x|
|
145
|
-
|`(a:, **kwargs)`|2.87x|2.29x|2.51x|2.10x|
|
146
|
-
|`(a, *args, b:, **kwargs)`|2.23x|1.88x|1.97x|1.73x|
|
147
|
-
|
148
134
|
You can run benchmarks yourself with:
|
149
135
|
|
150
136
|
```bash
|
@@ -153,7 +139,8 @@ $ bundle install
|
|
153
139
|
$ bundle exec ruby benchmarks.rb
|
154
140
|
```
|
155
141
|
|
156
|
-
If your results differ from what's posted here,
|
142
|
+
If your results differ from what's posted here, or if there's another gem we
|
143
|
+
should be benchmarking,
|
157
144
|
[let us know](https://github.com/panorama-ed/memo_wise/issues/new)!
|
158
145
|
|
159
146
|
## Thread Safety
|
@@ -299,7 +286,6 @@ Then carry out these steps:
|
|
299
286
|
|
300
287
|
**Project enhancements:** none
|
301
288
|
```
|
302
|
-
- Commit with title `Update CHANGELOG.md for x.y.z`
|
303
289
|
|
304
290
|
2. Update `lib/memo_wise/version.rb`
|
305
291
|
- Replace with upcoming version _x.y.z_
|
data/lib/memo_wise/version.rb
CHANGED
data/lib/memo_wise.rb
CHANGED
@@ -41,37 +41,8 @@ module MemoWise
|
|
41
41
|
# example, classes created by the
|
42
42
|
# [Values](https://github.com/tcrayford/Values)
|
43
43
|
# [gem](https://rubygems.org/gems/values).
|
44
|
-
#
|
45
|
-
# To support syntax differences with keyword and positional arguments starting
|
46
|
-
# with ruby 2.7, we have to set up the initializer with some slightly
|
47
|
-
# different syntax for the different versions. This variance in syntax is not
|
48
|
-
# included in coverage reports since the branch chosen will never differ
|
49
|
-
# within a single ruby version. This means it is impossible for us to get
|
50
|
-
# 100% coverage of this line within a single CI run.
|
51
|
-
#
|
52
|
-
# See
|
53
|
-
# [this article](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/)
|
54
|
-
# for more information.
|
55
|
-
#
|
56
|
-
# :nocov:
|
57
|
-
all_args = RUBY_VERSION < "2.7" ? "*" : "..."
|
58
|
-
# :nocov:
|
59
44
|
class_eval <<~HEREDOC, __FILE__, __LINE__ + 1
|
60
|
-
|
61
|
-
#
|
62
|
-
# def initialize(...)
|
63
|
-
# MemoWise::InternalAPI.create_memo_wise_state!(self)
|
64
|
-
# super
|
65
|
-
# end
|
66
|
-
#
|
67
|
-
# On Ruby 2.6 or lower:
|
68
|
-
#
|
69
|
-
# def initialize(*)
|
70
|
-
# MemoWise::InternalAPI.create_memo_wise_state!(self)
|
71
|
-
# super
|
72
|
-
# end
|
73
|
-
|
74
|
-
def initialize(#{all_args})
|
45
|
+
def initialize(...)
|
75
46
|
MemoWise::InternalAPI.create_memo_wise_state!(self)
|
76
47
|
super
|
77
48
|
end
|
@@ -93,6 +64,13 @@ module MemoWise
|
|
93
64
|
end
|
94
65
|
private_constant(:CreateMemoWiseStateOnInherited)
|
95
66
|
|
67
|
+
module CreateMemoWiseStateOnIncluded
|
68
|
+
def included(base)
|
69
|
+
base.prepend(MemoWise)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
private_constant(:CreateMemoWiseStateOnIncluded)
|
73
|
+
|
96
74
|
# @private
|
97
75
|
#
|
98
76
|
# Private setup method, called automatically by `prepend MemoWise` in a class.
|
@@ -154,10 +132,7 @@ module MemoWise
|
|
154
132
|
klass.singleton_class.prepend(CreateMemoWiseStateOnExtended)
|
155
133
|
end
|
156
134
|
when Hash
|
157
|
-
unless method_name_or_hash.keys == [:self]
|
158
|
-
raise ArgumentError,
|
159
|
-
"`:self` is the only key allowed in memo_wise"
|
160
|
-
end
|
135
|
+
raise ArgumentError, "`:self` is the only key allowed in memo_wise" unless method_name_or_hash.keys == [:self]
|
161
136
|
|
162
137
|
method_name = method_name_or_hash[:self]
|
163
138
|
|
@@ -175,6 +150,8 @@ module MemoWise
|
|
175
150
|
if klass.is_a?(Class) && !klass.singleton_class?
|
176
151
|
klass.singleton_class.prepend(CreateMemoWiseStateOnInherited)
|
177
152
|
else
|
153
|
+
klass.singleton_class.prepend(CreateMemoWiseStateOnIncluded) if klass.is_a?(Module) && !klass.singleton_class?
|
154
|
+
|
178
155
|
klass.prepend(CreateMemoWiseStateOnInherited)
|
179
156
|
end
|
180
157
|
|
metadata
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memo_wise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Panorama Education
|
8
8
|
- Jacob Evelyn
|
9
9
|
- Jemma Issroff
|
10
10
|
- Marc Siegel
|
11
|
-
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date:
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
15
14
|
dependencies: []
|
16
|
-
description:
|
17
15
|
email:
|
18
16
|
- engineering@panoramaed.com
|
19
17
|
- jacobevelyn@gmail.com
|
@@ -36,7 +34,6 @@ metadata:
|
|
36
34
|
rubygems_mfa_required: 'true'
|
37
35
|
changelog_uri: https://github.com/panorama-ed/memo_wise/blob/main/CHANGELOG.md
|
38
36
|
source_code_uri: https://github.com/panorama-ed/memo_wise
|
39
|
-
post_install_message:
|
40
37
|
rdoc_options: []
|
41
38
|
require_paths:
|
42
39
|
- lib
|
@@ -44,15 +41,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
41
|
requirements:
|
45
42
|
- - ">="
|
46
43
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
44
|
+
version: 3.1.0
|
48
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
46
|
requirements:
|
50
47
|
- - ">="
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: '0'
|
53
50
|
requirements: []
|
54
|
-
rubygems_version: 3.
|
55
|
-
signing_key:
|
51
|
+
rubygems_version: 3.6.7
|
56
52
|
specification_version: 4
|
57
53
|
summary: The wise choice for Ruby memoization
|
58
54
|
test_files: []
|