memo_wise 1.11.0 → 1.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 580c75382ed661927635d86573723585ac070bb1b173684ca58d7c47250cdeeb
4
- data.tar.gz: 8fa8aadd0eeb70bedb7e7f149942b1959ce3b807ad24c99e4b5558fe283fc669
3
+ metadata.gz: ab71a63edee91cbbcbbdd2bcf944db9b2e583473e6bc5c5bcbb6fd8db87c1168
4
+ data.tar.gz: 4eb1cbc4d43959ee772aba057955f4598fc999f8cbbe3930d4f1c438e34a848b
5
5
  SHA512:
6
- metadata.gz: 8f12681421e4994476929d36d6ee7d16c7a67f4641540a8291b8fa1c939bc9d4877930ace711544ed8f9ec80d2db92ac266c3155e1e0a6fa05e4cea75630c704
7
- data.tar.gz: 82094910c30c4bfbb317b285f3a7f6bd7c03c34d427d0788c58c2e7cf329ab03e37862d817b3686edcf4b03d55c084a834964aca5957137f2199927155611fe6
6
+ metadata.gz: 99236f8f3e9e3108ca6c2c0ac41cdca3329cece4914f8fc8ad1a87496ce94de61b19f10da957a605e1a4171f141b180ddb57da9000f980d7d529e85f005bc1e6
7
+ data.tar.gz: c99c03968b97643e2b86a0d3cdefa13302c45d148a7a843ef6b94d2e2bc9922e7f174d40d2cd735c7199c3333ca0524e424c7c9fedf93d6ae571f2b11e23572e
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.11.0...HEAD)
8
+ ## [Unreleased](https://github.com/panorama-ed/memo_wise/compare/v1.13.0...HEAD)
9
9
 
10
10
  **Gem enhancements:** none
11
11
 
@@ -13,6 +13,32 @@ _No breaking changes!_
13
13
 
14
14
  **Project enhancements:** none
15
15
 
16
+ ## [v1.13.0](https://github.com/panorama-ed/memo_wise/compare/v1.12.0...v1.13.0)
17
+
18
+ **Gem enhancements:**
19
+
20
+ - Prevented overwriting of `included` in modules prepending `MemoWise` [[#387]](https://github.com/panorama-ed/memo_wise/pull/387))
21
+
22
+ _No breaking changes!_
23
+
24
+ **Project enhancements:** none
25
+
26
+ ## [v1.12.0](https://github.com/panorama-ed/memo_wise/compare/v1.11.0...v1.12.0)
27
+
28
+ **Gem enhancements:** none
29
+
30
+ - Allowed memoization when `include`d modules `prepend MemoWise` and define `initialize` [[#327]](https://github.com/panorama-ed/memo_wise/pull/327)
31
+
32
+ _Breaking changes:_
33
+ - 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)
34
+
35
+ **Project enhancements:**
36
+
37
+ - Updated official test coverage to support Ruby 3.4 [[#335](https://github.com/panorama-ed/memo_wise/pull/335)]
38
+ - Updated `memery` gem version to 1.7.0 in benchmarks [[#380](https://github.com/panorama-ed/memo_wise/pull/380)]
39
+ - Added `short_circu_it` gem to benchmarks [[#384](https://github.com/panorama-ed/memo_wise/pull/384)]
40
+ - Increased benchmark warmup time to reduce warmup artifacts when benchmarking locally [[#355](https://github.com/panorama-ed/memo_wise/pull/355)]
41
+
16
42
  ## [v1.11.0](https://github.com/panorama-ed/memo_wise/compare/v1.10.0...v1.11.0)
17
43
 
18
44
  **Gem enhancements:**
@@ -40,6 +66,7 @@ _No breaking changes!_
40
66
 
41
67
  - Updated official test coverage to support Ruby 3.3 [[#335](https://github.com/panorama-ed/memo_wise/pull/335)]
42
68
  - Added `alt_memery` and `memoist3` to benchmarks [[#339](https://github.com/panorama-ed/memo_wise/pull/339)]
69
+ - Updated `memery` gem version to 1.6.0 in benchmarks [[#339](https://github.com/panorama-ed/memo_wise/pull/339)]
43
70
  - Updated benchmark results in `README.md` to Ruby 3.3.5 [[#339](https://github.com/panorama-ed/memo_wise/pull/339)]
44
71
 
45
72
  ## [v1.9.0](https://github.com/panorama-ed/memo_wise/compare/v1.8.0...v1.9.0)
@@ -69,9 +96,9 @@ _No breaking changes!_
69
96
 
70
97
  - Switched RuboCop configuration from `panolint` to `panolint-ruby` [[#312](https://github.com/panorama-ed/memo_wise/pull/312)]
71
98
  - 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 `Dry::Core` gem version to 1.0.0 in benchmarks [[#297](https://github.com/panorama-ed/memo_wise/pull/297)]
73
- - Updated `Memery` gem version to 1.5.0 in benchmarks [[#313](https://github.com/panorama-ed/memo_wise/pull/313)]
74
- - Updated `Memoized` gem version to 1.1.1 in benchmarks [[#288](https://github.com/panorama-ed/memo_wise/pull/288)]
99
+ - Updated `dry-core` gem version to 1.0.0 in benchmarks [[#297](https://github.com/panorama-ed/memo_wise/pull/297)]
100
+ - Updated `memery` gem version to 1.5.0 in benchmarks [[#313](https://github.com/panorama-ed/memo_wise/pull/313)]
101
+ - Updated `memoized` gem version to 1.1.1 in benchmarks [[#288](https://github.com/panorama-ed/memo_wise/pull/288)]
75
102
  - Reorganized `CHANGELOG.md` for improved clarity and completeness [[#282](https://github.com/panorama-ed/memo_wise/pull/282)]
76
103
 
77
104
  ## [v1.7.0](https://github.com/panorama-ed/memo_wise/compare/v1.6.0...v1.7.0) - 2022-04-04
@@ -256,7 +283,7 @@ _No breaking changes!_
256
283
 
257
284
  **Project enhancements:**
258
285
 
259
- - Tests now assert that memoization works with the `Values` gem
286
+ - Tests now assert that memoization works with the `values` gem
260
287
  [[#46](https://github.com/panorama-ed/memo_wise/pull/46)]
261
288
  - Added `README.md` badges for tests, docs, and RubyGems
262
289
  [[#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.6:
118
-
119
- |Method arguments|`alt_memery` (2.1.0)|`dry-core`\* (1.0.2)|`memery` (1.6.0)|`memoist3` (1.0.0)|
120
- |--|--|--|--|--|
121
- |`()` (none)|12.97x|0.63x|3.31x|2.62x|
122
- |`(a)`|9.62x|0.99x|3.86x|14.61x|
123
- |`(a, b)`|7.82x|0.85x|3.12x|11.75x|
124
- |`(a:)`|15.36x|1.01x|6.72x|19.70x|
125
- |`(a:, b:)`|13.07x|0.90x|5.61x|20.64x|
126
- |`(a, b:)`|12.68x|0.89x|5.63x|16.27x|
127
- |`(a, *args)`|1.93x|0.74x|0.78x|2.85x|
128
- |`(a:, **kwargs)`|2.81x|0.72x|1.19x|4.48x|
129
- |`(a, *args, b:, **kwargs)`|1.75x|0.66x|0.87x|2.82x|
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.20x|0.57x|3.31x|2.76x|18.45x|
122
+ |`(a)`|9.75x|0.98x|3.76x|14.54x|13.96x|
123
+ |`(a, b)`|7.59x|0.82x|2.92x|11.39x|10.87x|
124
+ |`(a:)`|14.89x|0.97x|6.39x|19.76x|12.60x|
125
+ |`(a:, b:)`|12.64x|0.86x|5.43x|21.05x|10.70x|
126
+ |`(a, b:)`|12.25x|0.84x|5.22x|16.12x|10.31x|
127
+ |`(a, *args)`|1.89x|0.65x|0.73x|2.84x|2.70x|
128
+ |`(a:, **kwargs)`|2.86x|0.71x|1.21x|4.79x|2.42x|
129
+ |`(a, *args, b:, **kwargs)`|1.81x|0.62x|0.83x|3.03x|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
@@ -278,14 +265,7 @@ the [code of conduct](https://github.com/panorama-ed/memo_wise/blob/main/CODE_OF
278
265
  ## Releasing
279
266
 
280
267
  To make a new release of `MemoWise` to
281
- [RubyGems](https://rubygems.org/gems/memo_wise), first install the `release`
282
- dependencies (e.g. `rake`) as follows:
283
-
284
- ```shell
285
- BUNDLE_WITH=release bundle install
286
- ```
287
-
288
- Then carry out these steps:
268
+ [RubyGems](https://rubygems.org/gems/memo_wise):
289
269
 
290
270
  1. Update `CHANGELOG.md`:
291
271
  - Add an entry for the upcoming version _x.y.z_
@@ -299,14 +279,13 @@ Then carry out these steps:
299
279
 
300
280
  **Project enhancements:** none
301
281
  ```
302
- - Commit with title `Update CHANGELOG.md for x.y.z`
303
282
 
304
283
  2. Update `lib/memo_wise/version.rb`
305
284
  - Replace with upcoming version _x.y.z_
306
285
  - Run `bundle install` to update `Gemfile.lock`
307
286
  - Commit with title `Bump version to x.y.z`
308
287
 
309
- 3. `bundle exec rake release`
288
+ 3. `BUNDLE_WITH=release bundle install && BUNDLE_WITH=release bundle exec rake release`
310
289
 
311
290
  ## License
312
291
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MemoWise
4
- VERSION = "1.11.0"
4
+ VERSION = "1.13.0"
5
5
  end
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
- # On Ruby 2.7 or greater:
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,14 @@ module MemoWise
93
64
  end
94
65
  private_constant(:CreateMemoWiseStateOnInherited)
95
66
 
67
+ module CreateMemoWiseStateOnIncluded
68
+ def included(base)
69
+ base.prepend(MemoWise)
70
+ super
71
+ end
72
+ end
73
+ private_constant(:CreateMemoWiseStateOnIncluded)
74
+
96
75
  # @private
97
76
  #
98
77
  # Private setup method, called automatically by `prepend MemoWise` in a class.
@@ -154,10 +133,7 @@ module MemoWise
154
133
  klass.singleton_class.prepend(CreateMemoWiseStateOnExtended)
155
134
  end
156
135
  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
136
+ raise ArgumentError, "`:self` is the only key allowed in memo_wise" unless method_name_or_hash.keys == [:self]
161
137
 
162
138
  method_name = method_name_or_hash[:self]
163
139
 
@@ -175,6 +151,8 @@ module MemoWise
175
151
  if klass.is_a?(Class) && !klass.singleton_class?
176
152
  klass.singleton_class.prepend(CreateMemoWiseStateOnInherited)
177
153
  else
154
+ klass.singleton_class.prepend(CreateMemoWiseStateOnIncluded) if klass.is_a?(Module) && !klass.singleton_class?
155
+
178
156
  klass.prepend(CreateMemoWiseStateOnInherited)
179
157
  end
180
158
 
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.11.0
4
+ version: 1.13.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: 2025-02-26 00:00:00.000000000 Z
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: 2.7.0
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.5.16
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: []