lite-memoize 1.0.2 → 1.1.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: 764d8311718bd18bada8e3f63104f1e81f9e300a995dbac0f61a41ded9706cd0
4
- data.tar.gz: 9d6abb3e67c30129a3e9401fbdb1f213238991ccf9a636a0f889260081a29dd2
3
+ metadata.gz: e8d31dc6c0952b7d08df26d9db0bfc2de04397f1c875649e30dd1ec991974d41
4
+ data.tar.gz: 42f03b953d56020bb3f6e115a25af3bb62619354814ecbbc5f75d9859df9f71c
5
5
  SHA512:
6
- metadata.gz: c34cde89e7350fb9d95d111924b90045ec0927d4f2f997623dba9ac28d794a06be10136cdc71e1f621f19f763af73a3688a7c983c7f651bfa10ee3c610266589
7
- data.tar.gz: 4491d5d262bb90fcbc15a951f99bfeefc7ffa7631a4326f5037de0c5ca2016fa8f9b671f8575f16d5aea23c0ecda3d0a60d56e82d035ca0624c37cc13bc938ed
6
+ metadata.gz: ef29fa0f0017a4300b1694d3dc022e0e85760b909954dfa6a20d11c9a435552c406ae81eeb161ce663d42c8e30dd6005c31f9885e43d13867776c218240d7ecd
7
+ data.tar.gz: da305aa07fdb795a5a105d92cbab19706e737a8b172553567c60251daa18014dffcb92e9f776bd628f4d67819a686ab36b3d62f52d78c2b87e2bc34cda99ad04
data/.rubocop.yml CHANGED
@@ -2,11 +2,14 @@ require:
2
2
  - rubocop-performance
3
3
  - rubocop-rspec
4
4
  AllCops:
5
- TargetRubyVersion: 2.6
5
+ TargetRubyVersion: 3.0
6
+ NewCops: enable
6
7
  DisplayCopNames: true
7
8
  DisplayStyleGuide: true
8
- LineLength:
9
- Max: 100
9
+ Gemspec/RequiredRubyVersion:
10
+ Enabled: false
11
+ Layout/EmptyLinesAroundAttributeAccessor:
12
+ Enabled: true
10
13
  Layout/EmptyLinesAroundBlockBody:
11
14
  Exclude:
12
15
  - 'spec/**/**/*'
@@ -14,6 +17,14 @@ Layout/EmptyLinesAroundClassBody:
14
17
  EnforcedStyle: empty_lines_except_namespace
15
18
  Layout/EmptyLinesAroundModuleBody:
16
19
  EnforcedStyle: empty_lines_except_namespace
20
+ Layout/LineLength:
21
+ Max: 100
22
+ Layout/SpaceAroundMethodCallOperator:
23
+ Enabled: true
24
+ Lint/RaiseException:
25
+ Enabled: true
26
+ Lint/StructNewOverride:
27
+ Enabled: true
17
28
  Metrics/BlockLength:
18
29
  Exclude:
19
30
  - 'spec/**/**/*'
@@ -24,9 +35,15 @@ Naming/FileName:
24
35
  Enabled: false
25
36
  Naming/MemoizedInstanceVariableName:
26
37
  Enabled: false
27
- Naming/UncommunicativeMethodParamName:
38
+ Naming/MethodParameterName:
39
+ Enabled: false
40
+ Style/AccessModifierDeclarations:
41
+ Enabled: false
42
+ Style/ArgumentsForwarding:
28
43
  Enabled: false
29
44
  Style/Documentation:
30
45
  Enabled: false
46
+ Style/DocumentDynamicEvalDefinition:
47
+ Enabled: false
31
48
  Style/ExpandPathArguments:
32
49
  Enabled: false
data/.travis.yml CHANGED
@@ -4,6 +4,7 @@ cache: bundler
4
4
  rvm:
5
5
  - 2.5
6
6
  - 2.6
7
+ - 2.7
7
8
  - ruby-head
8
9
  matrix:
9
10
  fast_finish: true
data/CHANGELOG.md CHANGED
@@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.1.1] - 2021-07-22
10
+ ### Changed
11
+ - Improved setup
12
+
13
+ ## [1.1.0] - 2021-07-19
14
+ ### Added
15
+ - Added Ruby 3.0 support
16
+
17
+ ## [1.0.4] - 2021-05-07
18
+ ### Changed
19
+ - Performance bind call
20
+
21
+ ## [1.0.3] - 2019-08-13
22
+ ### Added
23
+ - Added ruby 2.7 support
24
+ - Added clear alias from clear_cache on Alias
25
+
9
26
  ## [1.0.2] - 2019-08-07
10
27
  ### Added
11
28
  - Added variable base memoization
data/Gemfile.lock CHANGED
@@ -1,52 +1,61 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-memoize (1.0.2)
4
+ lite-memoize (1.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.0)
9
+ ast (2.4.2)
10
10
  colorize (0.8.1)
11
- diff-lcs (1.3)
12
- fasterer (0.5.1)
11
+ diff-lcs (1.4.4)
12
+ fasterer (0.9.0)
13
13
  colorize (~> 0.7)
14
- ruby_parser (>= 3.13.0)
15
- jaro_winkler (1.5.3)
16
- parallel (1.17.0)
17
- parser (2.6.3.0)
18
- ast (~> 2.4.0)
14
+ ruby_parser (>= 3.14.1)
15
+ parallel (1.20.1)
16
+ parser (3.0.2.0)
17
+ ast (~> 2.4.1)
19
18
  rainbow (3.0.0)
20
- rake (12.3.2)
21
- rspec (3.8.0)
22
- rspec-core (~> 3.8.0)
23
- rspec-expectations (~> 3.8.0)
24
- rspec-mocks (~> 3.8.0)
25
- rspec-core (3.8.1)
26
- rspec-support (~> 3.8.0)
27
- rspec-expectations (3.8.4)
19
+ rake (13.0.6)
20
+ regexp_parser (2.1.1)
21
+ rexml (3.2.5)
22
+ rspec (3.10.0)
23
+ rspec-core (~> 3.10.0)
24
+ rspec-expectations (~> 3.10.0)
25
+ rspec-mocks (~> 3.10.0)
26
+ rspec-core (3.10.1)
27
+ rspec-support (~> 3.10.0)
28
+ rspec-expectations (3.10.1)
28
29
  diff-lcs (>= 1.2.0, < 2.0)
29
- rspec-support (~> 3.8.0)
30
- rspec-mocks (3.8.1)
30
+ rspec-support (~> 3.10.0)
31
+ rspec-mocks (3.10.2)
31
32
  diff-lcs (>= 1.2.0, < 2.0)
32
- rspec-support (~> 3.8.0)
33
- rspec-support (3.8.2)
34
- rubocop (0.71.0)
35
- jaro_winkler (~> 1.5.1)
33
+ rspec-support (~> 3.10.0)
34
+ rspec-support (3.10.2)
35
+ rubocop (1.18.3)
36
36
  parallel (~> 1.10)
37
- parser (>= 2.6)
37
+ parser (>= 3.0.0.0)
38
38
  rainbow (>= 2.2.2, < 4.0)
39
+ regexp_parser (>= 1.8, < 3.0)
40
+ rexml
41
+ rubocop-ast (>= 1.7.0, < 2.0)
39
42
  ruby-progressbar (~> 1.7)
40
- unicode-display_width (>= 1.4.0, < 1.7)
41
- rubocop-performance (1.4.0)
42
- rubocop (>= 0.71.0)
43
- rubocop-rspec (1.33.0)
44
- rubocop (>= 0.60.0)
45
- ruby-progressbar (1.10.1)
46
- ruby_parser (3.13.1)
47
- sexp_processor (~> 4.9)
48
- sexp_processor (4.12.1)
49
- unicode-display_width (1.6.0)
43
+ unicode-display_width (>= 1.4.0, < 3.0)
44
+ rubocop-ast (1.8.0)
45
+ parser (>= 3.0.1.1)
46
+ rubocop-performance (1.11.4)
47
+ rubocop (>= 1.7.0, < 2.0)
48
+ rubocop-ast (>= 0.4.0)
49
+ rubocop-rake (0.6.0)
50
+ rubocop (~> 1.0)
51
+ rubocop-rspec (2.4.0)
52
+ rubocop (~> 1.0)
53
+ rubocop-ast (>= 1.1.0)
54
+ ruby-progressbar (1.11.0)
55
+ ruby_parser (3.16.0)
56
+ sexp_processor (~> 4.15, >= 4.15.1)
57
+ sexp_processor (4.15.3)
58
+ unicode-display_width (2.0.0)
50
59
 
51
60
  PLATFORMS
52
61
  ruby
@@ -59,7 +68,8 @@ DEPENDENCIES
59
68
  rspec
60
69
  rubocop
61
70
  rubocop-performance
71
+ rubocop-rake
62
72
  rubocop-rspec
63
73
 
64
74
  BUNDLED WITH
65
- 2.0.1
75
+ 2.2.24
data/lib/lite/memoize.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- %w[version alias table instance klass variable].each do |name|
4
- require "lite/memoize/#{name}"
5
- end
3
+ require 'lite/memoize/version'
4
+ require 'lite/memoize/alias'
5
+ require 'lite/memoize/table'
6
+ require 'lite/memoize/instance'
7
+ require 'lite/memoize/klass'
8
+ require 'lite/memoize/variable'
@@ -34,13 +34,13 @@ module Lite
34
34
  end
35
35
  end
36
36
 
37
+ alias clear clear_cache
37
38
  alias flush_cache clear_cache
38
39
 
39
40
  end
40
41
 
41
42
  class << self
42
43
 
43
- # rubocop:disable Lint/NestedMethodDefinition
44
44
  def extended(extender)
45
45
  Lite::Memoize::Alias.memoist_eval(extender) do
46
46
  return if singleton_class.method_defined?(:memoized_methods)
@@ -50,7 +50,6 @@ module Lite
50
50
  end
51
51
  end
52
52
  end
53
- # rubocop:enable Lint/NestedMethodDefinition
54
53
 
55
54
  def memoized_ivar_for(method_name, as = nil)
56
55
  "@#{memoized_prefix(as)}_#{escape_punctuation(method_name)}"
@@ -26,11 +26,11 @@ module Lite
26
26
  store.delete(key)
27
27
  end
28
28
 
29
- # :nocov:
29
+ # rubocop:disable Style/ExplicitBlockArgument
30
30
  def each
31
31
  store.each { |key, val| yield(key, val) }
32
32
  end
33
- # :nocov:
33
+ # rubocop:enable Style/ExplicitBlockArgument
34
34
 
35
35
  def empty?
36
36
  store.empty?
@@ -12,13 +12,11 @@ module Lite
12
12
  define_method(method_name) do |*args|
13
13
  key = self.class.caller_key(args, as: as || method_name)
14
14
 
15
- self.class.store[key] ||= inner_method.bind(self).call(*args)
15
+ self.class.store[key] ||= inner_method.bind_call(self, *args)
16
16
  end
17
17
  end
18
18
 
19
- # rubocop:disable Style/AccessModifierDeclarations
20
19
  public :caller_key
21
- # rubocop:enable Style/AccessModifierDeclarations
22
20
 
23
21
  end
24
22
  end
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Memoize
5
5
 
6
- VERSION ||= '1.0.2'
6
+ VERSION = '1.1.1'
7
7
 
8
8
  end
9
9
  end
data/lite-memoize.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  )
26
26
  else
27
27
  raise 'RubyGems 2.0 or newer is required to protect against ' \
28
- 'public gem pushes.'
28
+ 'public gem pushes.'
29
29
  end
30
30
 
31
31
  # Specify which files should be added to the gem when it is released.
@@ -43,5 +43,6 @@ Gem::Specification.new do |spec|
43
43
  spec.add_development_dependency 'rspec'
44
44
  spec.add_development_dependency 'rubocop'
45
45
  spec.add_development_dependency 'rubocop-performance'
46
+ spec.add_development_dependency 'rubocop-rake'
46
47
  spec.add_development_dependency 'rubocop-rspec'
47
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lite-memoize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-07 00:00:00.000000000 Z
11
+ date: 2021-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rake
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
  - !ruby/object:Gem::Dependency
98
112
  name: rubocop-rspec
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +122,7 @@ dependencies:
108
122
  - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
- description:
125
+ description:
112
126
  email:
113
127
  - j.gomez@drexed.com
114
128
  executables: []
@@ -151,7 +165,7 @@ homepage: http://drexed.github.io/lite-memoize
151
165
  licenses:
152
166
  - MIT
153
167
  metadata: {}
154
- post_install_message:
168
+ post_install_message:
155
169
  rdoc_options: []
156
170
  require_paths:
157
171
  - lib
@@ -166,8 +180,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
180
  - !ruby/object:Gem::Version
167
181
  version: '0'
168
182
  requirements: []
169
- rubygems_version: 3.0.4
170
- signing_key:
183
+ rubygems_version: 3.2.24
184
+ signing_key:
171
185
  specification_version: 4
172
186
  summary: Cache and memoization helpers for ruby Ruby classes
173
187
  test_files: []