mem 0.1.5 → 0.3.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 +5 -5
- data/.github/release.yml +23 -0
- data/.github/workflows/actions.lock +57 -0
- data/.github/workflows/bump-request.yml +26 -0
- data/.github/workflows/ci.yml +27 -0
- data/.github/workflows/github-label-sync.yml +18 -0
- data/.github/workflows/release.yml +11 -0
- data/.gitignore +3 -17
- data/.rubocop.yml +28 -0
- data/Gemfile +9 -1
- data/Gemfile.lock +76 -0
- data/README.md +11 -1
- data/Rakefile +12 -1
- data/lib/mem/core_ext.rb +4 -2
- data/lib/mem/version.rb +3 -1
- data/lib/mem.rb +10 -9
- data/mem.gemspec +17 -16
- data/spec/mem_spec.rb +27 -24
- data/spec/spec_helper.rb +10 -5
- metadata +20 -59
- data/CHANGELOG.md +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 12517b88fa07a5d76fd76e3871a6f9d7042cea0ae019172cd14e39d698deabec
|
|
4
|
+
data.tar.gz: cea58562f8eabcab1014f7b3c401ba4aa45f6e47ac0fb934ae4d98fe45168fda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5617a966b0890c574b2804171e908e669705c31922b0d938e12f0b9a9fb05d5ab76340dcac315d08ac690f9069f294c59a08aec2e7c0001cf2a7d6bd276133d0
|
|
7
|
+
data.tar.gz: 5b2a96288df93e35d3c58878c1a2147cde9645a0f2f50aff4c01e106c9e7641c9d003ccf5412cb09dfbc319e1a4128ca9e628b53006298899366782374c8f2b1
|
data/.github/release.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
changelog:
|
|
2
|
+
categories:
|
|
3
|
+
- title: Added
|
|
4
|
+
labels:
|
|
5
|
+
- add
|
|
6
|
+
- title: Changed
|
|
7
|
+
labels:
|
|
8
|
+
- change
|
|
9
|
+
- title: Deprecated
|
|
10
|
+
labels:
|
|
11
|
+
- deprecated
|
|
12
|
+
- title: Fixed
|
|
13
|
+
labels:
|
|
14
|
+
- fix
|
|
15
|
+
- title: Removed
|
|
16
|
+
labels:
|
|
17
|
+
- remove
|
|
18
|
+
- title: Security
|
|
19
|
+
labels:
|
|
20
|
+
- security
|
|
21
|
+
- title: Others
|
|
22
|
+
labels:
|
|
23
|
+
- "*"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# This file is machine-generated by `gh actions-lock`.
|
|
2
|
+
# Do not edit by hand; run `gh actions-lock` to update.
|
|
3
|
+
# Docs: https://gh.io/actions-lockfile
|
|
4
|
+
version: 'v0.0.3'
|
|
5
|
+
workflows:
|
|
6
|
+
'.github/workflows/bump-request.yml':
|
|
7
|
+
- 'actions/checkout@v7.0.1'
|
|
8
|
+
- 'r7kamura/bump-request@v0.7.1'
|
|
9
|
+
- 'ruby/setup-ruby@v1.336.0'
|
|
10
|
+
'.github/workflows/ci.yml':
|
|
11
|
+
- 'actions/checkout@v7.0.1'
|
|
12
|
+
- 'ruby/setup-ruby@v1.336.0'
|
|
13
|
+
'.github/workflows/github-label-sync.yml':
|
|
14
|
+
- 'r7kamura/github-label-sync-action@v0.1.0'
|
|
15
|
+
'.github/workflows/release.yml': []
|
|
16
|
+
dependencies:
|
|
17
|
+
'actions/checkout@v3':
|
|
18
|
+
ref: 'v3'
|
|
19
|
+
commit: 'sha1-a37ce9120846195fa4ece8f58b268e6043cb2f26'
|
|
20
|
+
owner_id: 44036562
|
|
21
|
+
repo_id: 197814629
|
|
22
|
+
'actions/checkout@v7.0.1':
|
|
23
|
+
ref: 'v7.0.1'
|
|
24
|
+
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
|
|
25
|
+
owner_id: 44036562
|
|
26
|
+
repo_id: 197814629
|
|
27
|
+
'actions/setup-node@v3':
|
|
28
|
+
ref: 'v3'
|
|
29
|
+
commit: 'sha1-3235b876344d2a9aa001b8d1453c930bba69e610'
|
|
30
|
+
owner_id: 44036562
|
|
31
|
+
repo_id: 189476904
|
|
32
|
+
'actions/setup-node@v7.1.0':
|
|
33
|
+
ref: 'v7.1.0'
|
|
34
|
+
commit: 'sha1-949feb2413d6458794dcd2491c4babbbce0c15c1'
|
|
35
|
+
owner_id: 44036562
|
|
36
|
+
repo_id: 189476904
|
|
37
|
+
'r7kamura/bump-request@v0.7.1':
|
|
38
|
+
ref: 'v0.7.1'
|
|
39
|
+
commit: 'sha1-b27937188d404bc0c2fd442403e6de1d20f9b349'
|
|
40
|
+
owner_id: 111689
|
|
41
|
+
repo_id: 533135195
|
|
42
|
+
uses:
|
|
43
|
+
- 'actions/checkout@v7.0.1'
|
|
44
|
+
- 'actions/setup-node@v7.1.0'
|
|
45
|
+
'r7kamura/github-label-sync-action@v0.1.0':
|
|
46
|
+
ref: 'v0.1.0'
|
|
47
|
+
commit: 'sha1-061649dd3b80eb5bafad0316466f72962e62c300'
|
|
48
|
+
owner_id: 111689
|
|
49
|
+
repo_id: 514711932
|
|
50
|
+
uses:
|
|
51
|
+
- 'actions/checkout@v3'
|
|
52
|
+
- 'actions/setup-node@v3'
|
|
53
|
+
'ruby/setup-ruby@v1.336.0':
|
|
54
|
+
ref: 'v1.336.0'
|
|
55
|
+
commit: 'sha1-de492cf36cbab201753d720ce4f4e336cd688c94'
|
|
56
|
+
owner_id: 210414
|
|
57
|
+
repo_id: 231208785
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: bump-request
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version:
|
|
7
|
+
description: Version to change to.
|
|
8
|
+
required: true
|
|
9
|
+
type: string
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
run:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v7.0.1
|
|
16
|
+
- name: Set up Ruby
|
|
17
|
+
uses: ruby/setup-ruby@v1.336.0
|
|
18
|
+
with:
|
|
19
|
+
ruby-version: 3.3
|
|
20
|
+
bundler-cache: true
|
|
21
|
+
- uses: r7kamura/bump-request@v0.7.1
|
|
22
|
+
with:
|
|
23
|
+
command: |
|
|
24
|
+
sed -i -r 's/([0-9]+\.[0-9]+\.[0-9]+)/${{ inputs.version }}/' lib/mem/version.rb
|
|
25
|
+
bundle install
|
|
26
|
+
version: ${{ inputs.version }}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
name: Ruby ${{ matrix.ruby }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
ruby:
|
|
17
|
+
- '3.3'
|
|
18
|
+
- '3.4'
|
|
19
|
+
- '4.0'
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v7.0.1
|
|
22
|
+
- uses: ruby/setup-ruby@v1.336.0
|
|
23
|
+
with:
|
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
|
25
|
+
bundler-cache: true
|
|
26
|
+
- run: bundle exec rubocop --format progress --format github
|
|
27
|
+
- run: bundle exec rspec
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: github-label-sync
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- .github/workflows/github-label-sync.yml
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: r7kamura/github-label-sync-action@v0.1.0
|
|
16
|
+
with:
|
|
17
|
+
source_path: labels-keepachangelog.yml
|
|
18
|
+
source_repository: r7kamura/github-label-presets
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-rake
|
|
3
|
+
- rubocop-rspec
|
|
4
|
+
|
|
5
|
+
inherit_mode:
|
|
6
|
+
merge:
|
|
7
|
+
- Exclude
|
|
8
|
+
|
|
9
|
+
AllCops:
|
|
10
|
+
NewCops: enable
|
|
11
|
+
TargetRubyVersion: 3.3
|
|
12
|
+
|
|
13
|
+
Metrics:
|
|
14
|
+
Enabled: false
|
|
15
|
+
|
|
16
|
+
Naming/PredicatePrefix:
|
|
17
|
+
ForbiddenPrefixes:
|
|
18
|
+
- have_
|
|
19
|
+
- is_
|
|
20
|
+
|
|
21
|
+
RSpec/ExampleLength:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
RSpec/MultipleExpectations:
|
|
25
|
+
Enabled: false
|
|
26
|
+
|
|
27
|
+
Style/Documentation:
|
|
28
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
mem (0.3.0)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
ast (2.4.3)
|
|
10
|
+
diff-lcs (1.5.1)
|
|
11
|
+
json (3.1.0)
|
|
12
|
+
language_server-protocol (3.17.0.6)
|
|
13
|
+
lint_roller (1.1.0)
|
|
14
|
+
parallel (2.3.0)
|
|
15
|
+
parser (3.3.13.0)
|
|
16
|
+
ast (~> 2.4.1)
|
|
17
|
+
racc
|
|
18
|
+
prism (1.9.0)
|
|
19
|
+
racc (1.8.1)
|
|
20
|
+
rainbow (3.1.1)
|
|
21
|
+
rake (13.2.1)
|
|
22
|
+
regexp_parser (2.13.1)
|
|
23
|
+
rspec (3.13.0)
|
|
24
|
+
rspec-core (~> 3.13.0)
|
|
25
|
+
rspec-expectations (~> 3.13.0)
|
|
26
|
+
rspec-mocks (~> 3.13.0)
|
|
27
|
+
rspec-core (3.13.0)
|
|
28
|
+
rspec-support (~> 3.13.0)
|
|
29
|
+
rspec-expectations (3.13.2)
|
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
31
|
+
rspec-support (~> 3.13.0)
|
|
32
|
+
rspec-mocks (3.13.1)
|
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
34
|
+
rspec-support (~> 3.13.0)
|
|
35
|
+
rspec-support (3.13.1)
|
|
36
|
+
rubocop (1.92.2)
|
|
37
|
+
json (>= 2.3)
|
|
38
|
+
language_server-protocol (~> 3.17.0.2)
|
|
39
|
+
lint_roller (~> 1.1.0)
|
|
40
|
+
parallel (>= 1.10)
|
|
41
|
+
parser (>= 3.3.0.2)
|
|
42
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
43
|
+
regexp_parser (>= 2.11.3, < 3.0)
|
|
44
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
45
|
+
ruby-progressbar (~> 1.7)
|
|
46
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
47
|
+
rubocop-ast (1.50.0)
|
|
48
|
+
parser (>= 3.3.7.2)
|
|
49
|
+
prism (~> 1.7)
|
|
50
|
+
rubocop-rake (0.7.1)
|
|
51
|
+
lint_roller (~> 1.1)
|
|
52
|
+
rubocop (>= 1.72.1)
|
|
53
|
+
rubocop-rspec (3.10.2)
|
|
54
|
+
lint_roller (~> 1.1)
|
|
55
|
+
regexp_parser (>= 2.0)
|
|
56
|
+
rubocop (~> 1.86, >= 1.86.2)
|
|
57
|
+
ruby-progressbar (1.13.0)
|
|
58
|
+
unicode-display_width (3.3.0)
|
|
59
|
+
unicode-emoji (~> 4.3)
|
|
60
|
+
unicode-emoji (4.3.0)
|
|
61
|
+
|
|
62
|
+
PLATFORMS
|
|
63
|
+
ruby
|
|
64
|
+
x86_64-linux
|
|
65
|
+
|
|
66
|
+
DEPENDENCIES
|
|
67
|
+
bundler
|
|
68
|
+
mem!
|
|
69
|
+
rake
|
|
70
|
+
rspec
|
|
71
|
+
rubocop
|
|
72
|
+
rubocop-rake
|
|
73
|
+
rubocop-rspec
|
|
74
|
+
|
|
75
|
+
BUNDLED WITH
|
|
76
|
+
4.0.23
|
data/README.md
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
# Mem
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Memoize method calls.
|
|
3
4
|
|
|
4
5
|
## Installation
|
|
6
|
+
|
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
bundle add mem
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
14
|
+
|
|
5
15
|
```
|
|
6
16
|
gem install mem
|
|
7
17
|
```
|
data/Rakefile
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
4
|
+
require 'rspec/core/rake_task'
|
|
5
|
+
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
7
|
+
|
|
8
|
+
require 'rubocop/rake_task'
|
|
9
|
+
|
|
10
|
+
RuboCop::RakeTask.new
|
|
11
|
+
|
|
12
|
+
task default: %i[spec rubocop]
|
data/lib/mem/core_ext.rb
CHANGED
data/lib/mem/version.rb
CHANGED
data/lib/mem.rb
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'mem/version'
|
|
2
4
|
|
|
3
5
|
module Mem
|
|
4
6
|
def self.included(base)
|
|
@@ -28,10 +30,9 @@ module Mem
|
|
|
28
30
|
module ClassMethods
|
|
29
31
|
def memoize(method_name)
|
|
30
32
|
original_visibility =
|
|
31
|
-
|
|
32
|
-
when protected_instance_methods.include?(method_name)
|
|
33
|
+
if protected_method_defined?(method_name)
|
|
33
34
|
:protected
|
|
34
|
-
|
|
35
|
+
elsif private_method_defined?(method_name)
|
|
35
36
|
:private
|
|
36
37
|
else
|
|
37
38
|
:public
|
|
@@ -54,12 +55,12 @@ module Mem
|
|
|
54
55
|
end
|
|
55
56
|
send(original_visibility, "unmemoize_#{method_name}")
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
send(original_visibility, "#{method_name}=")
|
|
58
|
+
return unless original_visibility != :private
|
|
59
|
+
|
|
60
|
+
define_method("#{method_name}=") do |value|
|
|
61
|
+
memoize(method_name, value)
|
|
62
62
|
end
|
|
63
|
+
send(original_visibility, "#{method_name}=")
|
|
63
64
|
end
|
|
64
65
|
end
|
|
65
66
|
end
|
data/mem.gemspec
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/mem/version'
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name =
|
|
6
|
+
spec.name = 'mem'
|
|
7
7
|
spec.version = Mem::VERSION
|
|
8
|
-
spec.authors = [
|
|
9
|
-
spec.email = [
|
|
10
|
-
spec.summary =
|
|
11
|
-
spec.homepage =
|
|
12
|
-
spec.license =
|
|
8
|
+
spec.authors = ['Ryo Nakamura']
|
|
9
|
+
spec.email = ['r7kamura@gmail.com']
|
|
10
|
+
spec.summary = 'Memoize method calls.'
|
|
11
|
+
spec.homepage = 'https://github.com/r7kamura/mem'
|
|
12
|
+
spec.license = 'MIT'
|
|
13
|
+
|
|
14
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
15
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
|
16
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/releases"
|
|
17
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
13
18
|
|
|
14
|
-
spec.
|
|
15
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
16
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
17
|
-
spec.require_paths = ["lib"]
|
|
19
|
+
spec.required_ruby_version = '>= 3.3'
|
|
18
20
|
|
|
19
|
-
spec.
|
|
20
|
-
spec.
|
|
21
|
-
spec.add_development_dependency "rspec", "2.14.1"
|
|
21
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
|
22
|
+
spec.require_paths = ['lib']
|
|
22
23
|
end
|
data/spec/mem_spec.rb
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Mem do
|
|
6
|
+
describe '#memoize' do
|
|
7
|
+
before do
|
|
8
|
+
allow(object).to receive(:b).and_call_original
|
|
9
|
+
end
|
|
2
10
|
|
|
3
|
-
describe Mem do
|
|
4
|
-
describe "#memoize" do
|
|
5
11
|
let(:object) do
|
|
6
12
|
klass.new
|
|
7
13
|
end
|
|
8
14
|
|
|
9
|
-
context
|
|
15
|
+
context 'with normal method name' do
|
|
10
16
|
let(:klass) do
|
|
11
17
|
Class.new do
|
|
12
18
|
include Mem
|
|
@@ -21,26 +27,26 @@ describe Mem do
|
|
|
21
27
|
end
|
|
22
28
|
|
|
23
29
|
def c
|
|
24
|
-
|
|
30
|
+
'c'
|
|
25
31
|
end
|
|
26
32
|
memoize :c
|
|
27
33
|
end
|
|
28
34
|
end
|
|
29
35
|
|
|
30
|
-
it
|
|
31
|
-
expect(object).to receive(:b).once.and_call_original
|
|
36
|
+
it 'memoizes the method call' do
|
|
32
37
|
expect(object.a(1) { 2 }).to eq [1, 2]
|
|
33
38
|
expect(object.a(3) { 4 }).to eq [1, 2]
|
|
39
|
+
expect(object).to have_received(:b).once
|
|
34
40
|
end
|
|
35
41
|
|
|
36
|
-
it
|
|
37
|
-
expect(object.c).to eq
|
|
38
|
-
object.c =
|
|
39
|
-
expect(object.c).to eq
|
|
42
|
+
it 'defines setter' do
|
|
43
|
+
expect(object.c).to eq 'c'
|
|
44
|
+
object.c = 'd'
|
|
45
|
+
expect(object.c).to eq 'd'
|
|
40
46
|
end
|
|
41
47
|
end
|
|
42
48
|
|
|
43
|
-
context
|
|
49
|
+
context 'with abnormal method name' do
|
|
44
50
|
let(:klass) do
|
|
45
51
|
Class.new do
|
|
46
52
|
include Mem
|
|
@@ -56,35 +62,32 @@ describe Mem do
|
|
|
56
62
|
end
|
|
57
63
|
end
|
|
58
64
|
|
|
59
|
-
it
|
|
60
|
-
expect(object).to receive(:b).once.and_call_original
|
|
65
|
+
it 'memoizes the method call' do
|
|
61
66
|
expect(object.a!(1) { 2 }).to eq [1, 2]
|
|
62
67
|
expect(object.a!(3) { 4 }).to eq [1, 2]
|
|
63
|
-
object.
|
|
64
|
-
object.
|
|
65
|
-
object.
|
|
68
|
+
expect(object).to have_received(:b).once
|
|
69
|
+
expect(object).to have_memoized(:a!)
|
|
70
|
+
expect(object.memoized(:a!)).to eq [1, 2]
|
|
71
|
+
expect(object.memoized_table).to eq({ a!: [1, 2] })
|
|
66
72
|
end
|
|
67
73
|
end
|
|
68
74
|
|
|
69
|
-
context
|
|
75
|
+
context 'with non-public method name' do
|
|
70
76
|
let(:klass) do
|
|
71
77
|
Class.new do
|
|
72
78
|
include Mem
|
|
73
79
|
|
|
74
|
-
def a
|
|
75
|
-
end
|
|
80
|
+
def a; end
|
|
76
81
|
memoize :a
|
|
77
82
|
|
|
78
83
|
protected
|
|
79
84
|
|
|
80
|
-
def b
|
|
81
|
-
end
|
|
85
|
+
def b; end
|
|
82
86
|
memoize :b
|
|
83
87
|
|
|
84
88
|
private
|
|
85
89
|
|
|
86
|
-
def c
|
|
87
|
-
end
|
|
90
|
+
def c; end
|
|
88
91
|
memoize :c
|
|
89
92
|
end
|
|
90
93
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'mem'
|
|
3
4
|
|
|
4
5
|
RSpec.configure do |config|
|
|
5
|
-
config.
|
|
6
|
-
|
|
7
|
-
config.
|
|
6
|
+
config.disable_monkey_patching!
|
|
7
|
+
|
|
8
|
+
config.expect_with :rspec do |c|
|
|
9
|
+
c.syntax = :expect
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
config.filter_run_when_matching :focus
|
|
8
13
|
end
|
metadata
CHANGED
|
@@ -1,67 +1,30 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mem
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryo Nakamura
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: bundler
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - ">="
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
20
|
-
type: :development
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: rake
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rspec
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - '='
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: 2.14.1
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - '='
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: 2.14.1
|
|
55
|
-
description:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
56
12
|
email:
|
|
57
13
|
- r7kamura@gmail.com
|
|
58
14
|
executables: []
|
|
59
15
|
extensions: []
|
|
60
16
|
extra_rdoc_files: []
|
|
61
17
|
files:
|
|
18
|
+
- ".github/release.yml"
|
|
19
|
+
- ".github/workflows/actions.lock"
|
|
20
|
+
- ".github/workflows/bump-request.yml"
|
|
21
|
+
- ".github/workflows/ci.yml"
|
|
22
|
+
- ".github/workflows/github-label-sync.yml"
|
|
23
|
+
- ".github/workflows/release.yml"
|
|
62
24
|
- ".gitignore"
|
|
63
|
-
-
|
|
25
|
+
- ".rubocop.yml"
|
|
64
26
|
- Gemfile
|
|
27
|
+
- Gemfile.lock
|
|
65
28
|
- LICENSE.txt
|
|
66
29
|
- README.md
|
|
67
30
|
- Rakefile
|
|
@@ -74,8 +37,11 @@ files:
|
|
|
74
37
|
homepage: https://github.com/r7kamura/mem
|
|
75
38
|
licenses:
|
|
76
39
|
- MIT
|
|
77
|
-
metadata:
|
|
78
|
-
|
|
40
|
+
metadata:
|
|
41
|
+
homepage_uri: https://github.com/r7kamura/mem
|
|
42
|
+
source_code_uri: https://github.com/r7kamura/mem
|
|
43
|
+
changelog_uri: https://github.com/r7kamura/mem/releases
|
|
44
|
+
rubygems_mfa_required: 'true'
|
|
79
45
|
rdoc_options: []
|
|
80
46
|
require_paths:
|
|
81
47
|
- lib
|
|
@@ -83,19 +49,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
83
49
|
requirements:
|
|
84
50
|
- - ">="
|
|
85
51
|
- !ruby/object:Gem::Version
|
|
86
|
-
version: '
|
|
52
|
+
version: '3.3'
|
|
87
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
54
|
requirements:
|
|
89
55
|
- - ">="
|
|
90
56
|
- !ruby/object:Gem::Version
|
|
91
57
|
version: '0'
|
|
92
58
|
requirements: []
|
|
93
|
-
|
|
94
|
-
rubygems_version: 2.2.2
|
|
95
|
-
signing_key:
|
|
59
|
+
rubygems_version: 4.0.20
|
|
96
60
|
specification_version: 4
|
|
97
|
-
summary: Memoize
|
|
98
|
-
test_files:
|
|
99
|
-
- spec/mem_spec.rb
|
|
100
|
-
- spec/spec_helper.rb
|
|
101
|
-
has_rdoc:
|
|
61
|
+
summary: Memoize method calls.
|
|
62
|
+
test_files: []
|
data/CHANGELOG.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
## 0.1.5
|
|
2
|
-
* Fix method visibility
|
|
3
|
-
|
|
4
|
-
## 0.1.4
|
|
5
|
-
* Add support for removing memoization
|
|
6
|
-
|
|
7
|
-
## 0.1.3
|
|
8
|
-
* Support memoize/core_ext only use
|
|
9
|
-
|
|
10
|
-
## 0.1.2
|
|
11
|
-
* Add memoize/core_ext
|
|
12
|
-
|
|
13
|
-
## 0.1.1
|
|
14
|
-
* Define setter on `.memoize`
|
|
15
|
-
|
|
16
|
-
## 0.1.0
|
|
17
|
-
* Change interface from `extend Mem` to `include Mem`
|
|
18
|
-
* Change stored data structure from ivar to hash table
|
|
19
|
-
* Add some instance methods to inspect memoized table
|
|
20
|
-
|
|
21
|
-
## 0.0.2
|
|
22
|
-
* Remove dependency on ActiveSupport
|
|
23
|
-
|
|
24
|
-
## 0.0.1
|
|
25
|
-
* 1st release
|