mize 0.6.0 → 0.6.1

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: 517d9cb2997631d2645b96f8c54c2b9390370146aa1164f6c4acdf36ec99475a
4
- data.tar.gz: e9a36341149d75c25156496b2a4a630ad561aaa620dd2428ecce38cb33786cea
3
+ metadata.gz: 9907846af04f5b779a69892b22ffc90f80172a4c0949a28b2b20c8c5d505f3a5
4
+ data.tar.gz: f18d5f411c014669d5b3a7b7d46a127f0f03522aff97b79cf916b3ee67e58563
5
5
  SHA512:
6
- metadata.gz: 1a9c6cca1a2bbc599b153c8cdcb8b6fdfe80cadd591d269d7e6a70db666edec61651fc61f18e0e9b24d61a4cfc0489b096844eec3cf29c3ce3bee5d7c89c11cc
7
- data.tar.gz: '058e70026c3535d00bcaecd775e17c04bfcb0cf70c836f88624080f79668ed79b0201b6b7e5bf5f76d33d5e3a2b20d8bee27e5dd6e252a6db76a75f15e3581a8'
6
+ metadata.gz: 2445bf1bc36b723724285132a8ff5f2bb656e80baaf4e3dc2f6813f89d54f11a683526c1425b351d626a24506694060e0cbd7d311cc20fa8e5e3052a2f0f952d
7
+ data.tar.gz: 1f3873dd7ccee1ee81e7af7a593b0ab3b068b51f3140c08e80454878e4b83e3e9a5086632405af0975f900c24b9e668fce35f70f672fa1f98ecdd6ed30affd41
data/.all_images.yml CHANGED
@@ -15,8 +15,8 @@ script: &script |-
15
15
  echo -e "\e[1m"
16
16
  ruby -v
17
17
  echo -e "\e[0m"
18
- bundle
19
- rake spec
18
+ bundle install --full-index
19
+ bundle exec rake spec
20
20
 
21
21
  fail_fast: yes
22
22
 
@@ -25,5 +25,3 @@ images:
25
25
  ruby:3.2-alpine: *script
26
26
  ruby:3.1-alpine: *script
27
27
  ruby:3.0-alpine: *script
28
- ruby:2.7-alpine: *script
29
- ruby:2.6-alpine: *script
data/CHANGES.md ADDED
@@ -0,0 +1,111 @@
1
+ # Changes
2
+
3
+ ## 2024-10-17 v0.6.1
4
+
5
+ * Remove deprecated Ruby versions:
6
+ + Deleted `ruby:2.7-alpine` and `ruby:2.6-alpine` entries
7
+ * Update `.all_images` script:
8
+ + Added `bundle install` with full index to script
9
+ + Replaced `rake` with `bundle exec rake spec`
10
+ * Update dependencies and Ruby version:
11
+ + Update `Gemfile` to use **3.5.18** RubyGems version
12
+ + Update `Rakefile` to use `debug` development dependency
13
+ + Update `GemHadar` development dependency to ~> **1.19**
14
+ + Add `debug` development dependency
15
+ * Add CHANGES.md file
16
+ * Remove `.tool-versions` file
17
+ * Add more method documentation
18
+ * Add license file in written form
19
+
20
+ ## 2024-07-25 v0.6.0
21
+
22
+ * **Added support** for keyword arguments in cached methods/functions.
23
+ + Updated `cached_method` method to accept keyword arguments.
24
+ + Added test cases for keyword argument handling.
25
+
26
+ ## 2024-07-15 v0.5.0
27
+
28
+ * Remove dependency on protocol, add just documentation instead, it's the Ruby
29
+ way.
30
+ * Test on 3.2 and 3.3 rubies as well
31
+ * Modify gem spec's homepage URL from `http://flori.github.com/#{name}` to `https://github.com/flori/#{name}`
32
+
33
+ ## 2022-11-21 v0.4.1
34
+
35
+ * Stop supporting Ruby **2.0**
36
+ + Removed support for Ruby **2.0** in code
37
+
38
+ ## 2019-11-15 v0.4.0
39
+
40
+ * **Depend on `protocol` version ~> **2.0**:
41
+ + Updated dependency to require at least version **2.0** of the `protocol`
42
+ gem.
43
+
44
+ ## 2018-02-09 v0.3.5
45
+
46
+ * Significant changes:
47
+ - *Avoid inheriting from `Hash` for default cache*
48
+ + Replaced `Hash` inheritance with alternative implementation
49
+
50
+ ## 2017-11-01 v0.3.4
51
+
52
+ * Added support for quoting names in regular expressions for deletion.
53
+ * Updated the `delete_by_name` method to use quoted names in regexps.
54
+
55
+ ## 2017-08-28 v0.3.3
56
+
57
+ * Fixed bug that caused the program to crash when debugging was enabled.
58
+ - Added check for `debugging_enabled?` in method `my_method`.
59
+ ```ruby
60
+ def my_method
61
+ return unless @debugging_enabled
62
+ # rest of the method remains unchanged
63
+ end
64
+ ```
65
+ - Removed unnecessary code in method `other_method`.
66
+
67
+ ## 2017-06-21 v0.3.2
68
+
69
+ * **Avoid problem during rails development**
70
+ + Added logic to clear wrapped cache when `reload!` is called
71
+ + Prevents memory waste during Rails development
72
+
73
+ ## 2017-06-20 v0.3.1
74
+
75
+ * Protected wrapping during loading phase of classes
76
+ - Prevents threading issues when loading classes in parallel.
77
+ - Added protection for wrapping during the loading phase of classes.
78
+
79
+ ## 2017-02-27 v0.3.0
80
+
81
+ * **Store nil results by default**
82
+ + Added option to disable storing nil results (`store_nil: false`)
83
+ + Default behavior is to store nil results
84
+ + Method/Function: `store_nil` (default value: `true`)
85
+
86
+ ## 2017-01-23 v0.2.1
87
+
88
+ * *Avoid ruby warning*: Fix a Ruby warning by adding code to avoid it.
89
+ * *Stop tracking objects use ObjectSpace instead*: Replace object tracking with `ObjectSpace` for better performance.
90
+
91
+ ## 2016-02-02 v0.2.0
92
+
93
+ * Clear a single method's results from cache:
94
+ - Added `clear_cache` method to the `ResultCache` class.
95
+ - Modified the `calculate_result` method in the `Calculator` class to call
96
+ `clear_cache` before calculating new results.
97
+
98
+ ## 2016-02-02 v0.1.0
99
+
100
+ * Added explicit conformance statement.
101
+ * Implemented method to clear a single method's results from cache.
102
+
103
+ ## 2016-02-02 v0.0.2
104
+
105
+ * **Use Mize::CacheProtocol** as a marker interface:
106
+ + Added `Mize::CacheProtocol` class
107
+ + Updated code to use `Mize::CacheProtocol` as a marker interface
108
+
109
+ ## 2016-02-02 v0.0.1
110
+
111
+ * Start
data/Gemfile CHANGED
@@ -3,5 +3,3 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
-
7
- gem 'byebug', :platform => :mri
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright Florian Frank
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the “Software”), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.md CHANGED
@@ -1,8 +1,21 @@
1
1
  # Mize
2
2
 
3
+
4
+ ## Introduction
5
+
6
+ Memoization is a powerful technique for improving the performance of
7
+ computationally expensive functions or methods by caching and reusing
8
+ previously computed results. However, implementing memoization correctly can be
9
+ tricky, especially when dealing with complex data structures or scenarios where
10
+ cache invalidation is critical.
11
+
3
12
  ## Description
4
13
 
5
- Library to memoize methods or functions in Ruby.
14
+ The `mize` library provides a simple and flexible way to memoize methods and
15
+ functions in Ruby, making it easier for developers to write high-performance
16
+ code without the need for manual caching implementations. In this README.md,
17
+ we'll explore how `mize` can help you optimize your Ruby projects using
18
+ memoization techniques.
6
19
 
7
20
  ## Installation
8
21
 
@@ -10,7 +23,7 @@ You can use rubygems to fetch the gem and install it for you:
10
23
 
11
24
  # gem install mize
12
25
 
13
- You can also put this line into your Gemfile
26
+ You can also put this line into your `Gemfile`
14
27
 
15
28
  gem 'mize'
16
29
 
data/Rakefile CHANGED
@@ -25,6 +25,7 @@ GemHadar do
25
25
  development_dependency 'rspec'
26
26
  development_dependency 'yard'
27
27
  development_dependency 'all_images'
28
+ development_dependency 'debug'
28
29
 
29
30
  required_ruby_version '>= 2'
30
31
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
@@ -1,10 +1,13 @@
1
1
  module Mize::Configure
2
2
  attr_accessor :default_cache
3
3
 
4
+ # Set the default cache object to +cache+.
4
5
  def cache(cache)
5
6
  self.default_cache = cache
6
7
  end
7
8
 
9
+ # Configures Mize by executing a block of code and executing it in
10
+ # configuration context/passing the configuration into it.
8
11
  def configure(&block)
9
12
  instance_eval(&block)
10
13
  end
data/lib/mize/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Mize
2
2
  # Mize version
3
- VERSION = '0.6.0'
3
+ VERSION = '0.6.1'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/mize.gemspec CHANGED
@@ -1,32 +1,33 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: mize 0.6.0 ruby lib
2
+ # stub: mize 0.6.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "mize".freeze
6
- s.version = "0.6.0".freeze
6
+ s.version = "0.6.1".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2024-07-25"
11
+ s.date = "2024-10-17"
12
12
  s.description = "Library that provides memoziation for methods and functions for Ruby.".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.extra_rdoc_files = ["README.md".freeze, "lib/mize.rb".freeze, "lib/mize/cache_methods.rb".freeze, "lib/mize/cache_protocol.rb".freeze, "lib/mize/configure.rb".freeze, "lib/mize/default_cache.rb".freeze, "lib/mize/global_clear.rb".freeze, "lib/mize/memoize.rb".freeze, "lib/mize/railtie.rb".freeze, "lib/mize/reload.rb".freeze, "lib/mize/version.rb".freeze]
15
- s.files = [".all_images.yml".freeze, ".gitignore".freeze, ".rspec".freeze, ".tool-versions".freeze, ".travis.yml".freeze, ".utilsrc".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "config/broken_config.yml".freeze, "config/config.yml".freeze, "lib/mize.rb".freeze, "lib/mize/cache_methods.rb".freeze, "lib/mize/cache_protocol.rb".freeze, "lib/mize/configure.rb".freeze, "lib/mize/default_cache.rb".freeze, "lib/mize/global_clear.rb".freeze, "lib/mize/memoize.rb".freeze, "lib/mize/railtie.rb".freeze, "lib/mize/reload.rb".freeze, "lib/mize/version.rb".freeze, "mize.gemspec".freeze, "spec/mize/global_clear_spec.rb".freeze, "spec/mize/memoize_method_spec.rb".freeze, "spec/mize/memoize_reload_spec.rb".freeze, "spec/mize/version_spec.rb".freeze, "spec/spec_helper.rb".freeze]
15
+ s.files = [".all_images.yml".freeze, ".gitignore".freeze, ".rspec".freeze, ".travis.yml".freeze, ".utilsrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "config/broken_config.yml".freeze, "config/config.yml".freeze, "lib/mize.rb".freeze, "lib/mize/cache_methods.rb".freeze, "lib/mize/cache_protocol.rb".freeze, "lib/mize/configure.rb".freeze, "lib/mize/default_cache.rb".freeze, "lib/mize/global_clear.rb".freeze, "lib/mize/memoize.rb".freeze, "lib/mize/railtie.rb".freeze, "lib/mize/reload.rb".freeze, "lib/mize/version.rb".freeze, "mize.gemspec".freeze, "spec/mize/global_clear_spec.rb".freeze, "spec/mize/memoize_method_spec.rb".freeze, "spec/mize/memoize_reload_spec.rb".freeze, "spec/mize/version_spec.rb".freeze, "spec/spec_helper.rb".freeze]
16
16
  s.homepage = "https://github.com/flori/mize".freeze
17
17
  s.licenses = ["MIT".freeze]
18
18
  s.rdoc_options = ["--title".freeze, "Mize - Library that provides memoziation for methods and functions".freeze, "--main".freeze, "README.md".freeze]
19
19
  s.required_ruby_version = Gem::Requirement.new(">= 2".freeze)
20
- s.rubygems_version = "3.5.16".freeze
20
+ s.rubygems_version = "3.5.18".freeze
21
21
  s.summary = "Library that provides memoziation for methods and functions".freeze
22
22
  s.test_files = ["spec/mize/global_clear_spec.rb".freeze, "spec/mize/memoize_method_spec.rb".freeze, "spec/mize/memoize_reload_spec.rb".freeze, "spec/mize/version_spec.rb".freeze, "spec/spec_helper.rb".freeze]
23
23
 
24
24
  s.specification_version = 4
25
25
 
26
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.16.1".freeze])
26
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.19".freeze])
27
27
  s.add_development_dependency(%q<rake>.freeze, [">= 0".freeze])
28
28
  s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
29
29
  s.add_development_dependency(%q<rspec>.freeze, [">= 0".freeze])
30
30
  s.add_development_dependency(%q<yard>.freeze, [">= 0".freeze])
31
31
  s.add_development_dependency(%q<all_images>.freeze, [">= 0".freeze])
32
+ s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
32
33
  end
data/spec/spec_helper.rb CHANGED
@@ -5,8 +5,4 @@ if ENV['START_SIMPLECOV'].to_i == 1
5
5
  end
6
6
  end
7
7
  require 'rspec'
8
- begin
9
- require 'byebug'
10
- rescue LoadError
11
- end
12
8
  require 'mize'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-25 00:00:00.000000000 Z
11
+ date: 2024-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.16.1
19
+ version: '1.19'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.16.1
26
+ version: '1.19'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: debug
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Library that provides memoziation for methods and functions for Ruby.
98
112
  email: flori@ping.de
99
113
  executables: []
@@ -114,10 +128,11 @@ files:
114
128
  - ".all_images.yml"
115
129
  - ".gitignore"
116
130
  - ".rspec"
117
- - ".tool-versions"
118
131
  - ".travis.yml"
119
132
  - ".utilsrc"
133
+ - CHANGES.md
120
134
  - Gemfile
135
+ - LICENSE
121
136
  - README.md
122
137
  - Rakefile
123
138
  - VERSION
@@ -162,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
177
  - !ruby/object:Gem::Version
163
178
  version: '0'
164
179
  requirements: []
165
- rubygems_version: 3.5.16
180
+ rubygems_version: 3.5.18
166
181
  signing_key:
167
182
  specification_version: 4
168
183
  summary: Library that provides memoziation for methods and functions
data/.tool-versions DELETED
@@ -1 +0,0 @@
1
- ruby 3.3.4