memo_wise 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.dependabot/config.yml +13 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +4 -0
- data/.github/workflows/auto-approve-dependabot.yml +26 -0
- data/.github/workflows/main.yml +40 -0
- data/.github/workflows/remove-needs-qa.yml +35 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -0
- data/.yardopts +8 -0
- data/CHANGELOG.md +57 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/Gemfile +30 -0
- data/Gemfile.lock +111 -0
- data/LICENSE.txt +21 -0
- data/README.md +190 -0
- data/Rakefile +3 -0
- data/benchmarks/.ruby-version +1 -0
- data/benchmarks/Gemfile +17 -0
- data/benchmarks/Gemfile.lock +26 -0
- data/benchmarks/benchmarks.rb +240 -0
- data/bin/console +8 -0
- data/bin/setup +8 -0
- data/lib/memo_wise.rb +555 -0
- data/lib/memo_wise/version.rb +5 -0
- data/logo/logo.png +0 -0
- data/memo_wise.gemspec +37 -0
- metadata +76 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a1b98d394deb079784021cd44f5c7b41abdbf1cce2b0ce14b0a3957b12bfdabe
|
4
|
+
data.tar.gz: 45b6796cf708b5401a56edfd68156587f92826a71d833b7fe3bec24985d81ac9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9ba145822aef3d07b2385daffaef15c22f5ffd4604e68d1fbad5d2bdf682c7723bb9a109cdda69d26efd6e5c05a21c1f0310ae70a1dbfd0f18a28cbe92d13d6f
|
7
|
+
data.tar.gz: 210c34c42f11e9d761c0fda0512daf62a533ec0fe2f19609a6cf0e052a1f2e2fdf22a55711764865616a319e387bff83fc5a6505973a4d89483ef383af008d13
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Reference: https://dependabot.com/docs/config-file/
|
2
|
+
version: 1
|
3
|
+
update_configs:
|
4
|
+
- package_manager: "ruby:bundler"
|
5
|
+
directory: "/"
|
6
|
+
update_schedule: "live"
|
7
|
+
automerged_updates:
|
8
|
+
- match:
|
9
|
+
dependency_type: "development"
|
10
|
+
update_type: "all"
|
11
|
+
- package_manager: "ruby:bundler"
|
12
|
+
directory: "/benchmarks"
|
13
|
+
update_schedule: "live"
|
@@ -0,0 +1,4 @@
|
|
1
|
+
**Before merging:**
|
2
|
+
|
3
|
+
- [ ] Copy the latest benchmark results into the `README.md` and update this PR
|
4
|
+
- [ ] If this change merits an update to `CHANGELOG.md`, add an entry following Keep a Changelog [guidelines](https://keepachangelog.com/en/1.0.0/) with [semantic versioning](https://semver.org/)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# This workflow auto-approves pull-requests when the github actor is a
|
2
|
+
# dependabot user and it is opening a new pull request.
|
3
|
+
#
|
4
|
+
# The problem that this workflow solves is that we have branch protection on
|
5
|
+
# our repositories that prevent PRs from merging unless there is an
|
6
|
+
# approval present. The problem is that this will block PRs that dependabot
|
7
|
+
# may want to merge automatically. Auto-approving dependabot PRs will allow
|
8
|
+
# the automatic merge to complete. We control what gets automerged through
|
9
|
+
# the dependabot configuration.
|
10
|
+
#
|
11
|
+
# This is a known issue: https://github.com/dependabot/feedback/issues/852
|
12
|
+
name: Auto-approve dependabot pull requests
|
13
|
+
on:
|
14
|
+
pull_request:
|
15
|
+
types: [opened]
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
dependabot-triage:
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
if: (github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
|
21
|
+
|
22
|
+
steps:
|
23
|
+
- name: Auto-approve for dependabot
|
24
|
+
uses: hmarr/auto-approve-action@v2.0.0
|
25
|
+
with:
|
26
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: Main
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
branches:
|
5
|
+
- main
|
6
|
+
push:
|
7
|
+
branches:
|
8
|
+
- main
|
9
|
+
jobs:
|
10
|
+
ci:
|
11
|
+
name: CI
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
ruby: [jruby, 2.4, 2.5, 2.6, 2.7, 3.0]
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@main
|
19
|
+
- uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
22
|
+
- uses: actions/cache@v1
|
23
|
+
with:
|
24
|
+
path: vendor/bundle
|
25
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
26
|
+
restore-keys: |
|
27
|
+
${{ runner.os }}-gems-
|
28
|
+
- run: bundle config path vendor/bundle
|
29
|
+
- run: bundle config set without 'checks:docs'
|
30
|
+
if: matrix.ruby != 3.0
|
31
|
+
- run: bundle install --jobs 4 --retry 3
|
32
|
+
- run: bundle exec rspec
|
33
|
+
- run: bundle exec rubocop
|
34
|
+
if: matrix.ruby == 3.0
|
35
|
+
- run: bundle exec yard doctest
|
36
|
+
if: matrix.ruby == 3.0
|
37
|
+
- run: |
|
38
|
+
BUNDLE_GEMFILE=benchmarks/Gemfile bundle install --jobs 4 --retry 3
|
39
|
+
BUNDLE_GEMFILE=benchmarks/Gemfile bundle exec ruby benchmarks/benchmarks.rb
|
40
|
+
if: matrix.ruby == '2.7' || matrix.ruby == '3.0'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This workflow removes a "Needs QA" label from a PR when the actor is the
|
2
|
+
# dependabot user merging a PR.
|
3
|
+
#
|
4
|
+
# We need this mechanism to allow for automerging whitelisted dependencies while
|
5
|
+
# also allowing for blocking a merge to main for deployment (in the way that
|
6
|
+
# our other PRs work). When the automerge script runs in henchman, it looks
|
7
|
+
# for `Needs QA` on github pull requests, and if the label is present,
|
8
|
+
# blocks the commit from merging.
|
9
|
+
name: Remove 'Needs QA' label for auto-merged PRs.
|
10
|
+
on:
|
11
|
+
pull_request:
|
12
|
+
types: [closed]
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
remove-label:
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
if: >
|
18
|
+
(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
|
19
|
+
&& github.event.pull_request.merged
|
20
|
+
|
21
|
+
steps:
|
22
|
+
# Our triage workflow adds 'Needs QA' to the PR in order to block it from
|
23
|
+
# merging to production. This removes that label when dependabot is doing
|
24
|
+
# the merging.
|
25
|
+
- name: Remove QA Label
|
26
|
+
uses: actions/github-script@0.4.0
|
27
|
+
with:
|
28
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
29
|
+
script: |
|
30
|
+
github.issues.removeLabel({
|
31
|
+
issue_number: context.issue.number,
|
32
|
+
owner: context.repo.owner,
|
33
|
+
repo: context.repo.repo,
|
34
|
+
name: 'Needs QA'
|
35
|
+
})
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.0
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
(nothing yet!)
|
10
|
+
|
11
|
+
## [0.3.0] - 2021-02-11
|
12
|
+
### Added
|
13
|
+
- Changelog and tags
|
14
|
+
- Logo
|
15
|
+
- Memoization of class methods
|
16
|
+
- Support for instances created with `Class#allocate`
|
17
|
+
- Official testing and benchmarks for Ruby 3.0
|
18
|
+
- Release procedure for gem
|
19
|
+
|
20
|
+
## [0.2.0] - 2020-10-28
|
21
|
+
### Added
|
22
|
+
- `#preset_memo_wise` to preset memoization values
|
23
|
+
- YARD docs
|
24
|
+
- Code coverage setup, badge, tests to ensure 100% coverage
|
25
|
+
|
26
|
+
## [0.1.2] - 2020-10-01
|
27
|
+
### Added
|
28
|
+
- Tests to assert memoization works with Values gem
|
29
|
+
- Badges for tests, docs and gem
|
30
|
+
|
31
|
+
### Changed
|
32
|
+
- Internal data structure for memoization is a nested hash
|
33
|
+
- Separate `*args` and `**kwargs` in method signatures
|
34
|
+
|
35
|
+
## [0.1.1] - 2020-08-03
|
36
|
+
### Added
|
37
|
+
- Benchmarks comparing `MemoWise` to other Ruby memoization gems
|
38
|
+
- `#reset_memo_wise` resets memoization for specific arguments for methods
|
39
|
+
|
40
|
+
## [0.1.0] - 2020-07-20
|
41
|
+
### Added
|
42
|
+
- `#memo_wise` defined to enable memoization
|
43
|
+
- `#reset_memo_wise` and `#reset_all_memo_wise` defined to reset memoization
|
44
|
+
|
45
|
+
## [0.0.1] - 2020-06-29
|
46
|
+
### Added
|
47
|
+
- Initial gem project structure
|
48
|
+
- Panolint
|
49
|
+
- Dependabot setup
|
50
|
+
|
51
|
+
[Unreleased]: https://github.com/panorama-ed/memo_wise/compare/v0.3.0...HEAD
|
52
|
+
[0.3.0]: https://github.com/panorama-ed/memo_wise/compare/v0.2.0...v0.3.0
|
53
|
+
[0.2.0]: https://github.com/panorama-ed/memo_wise/compare/v0.1.2...v0.2.0
|
54
|
+
[0.1.2]: https://github.com/panorama-ed/memo_wise/compare/v0.1.1...v0.1.2
|
55
|
+
[0.1.1]: https://github.com/panorama-ed/memo_wise/compare/v0.1.0...v0.1.1
|
56
|
+
[0.1.0]: https://github.com/panorama-ed/memo_wise/compare/v0.0.1...v0.1.0
|
57
|
+
[0.0.1]: https://github.com/panorama-ed/memo_wise/releases/tag/v0.0.1
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at engineering@panoramaed.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
62
|
+
incident. Further details of specific enforcement policies may be posted
|
63
|
+
separately.
|
64
|
+
|
65
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
66
|
+
faith may face temporary or permanent repercussions as determined by other
|
67
|
+
members of the project's leadership.
|
68
|
+
|
69
|
+
## Attribution
|
70
|
+
|
71
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
72
|
+
version 1.4, available at
|
73
|
+
[https://contributor-covenant.org/version/1/4][version]
|
74
|
+
|
75
|
+
[homepage]: https://contributor-covenant.org
|
76
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
6
|
+
|
7
|
+
gemspec
|
8
|
+
|
9
|
+
group :test do
|
10
|
+
gem "rspec", "~> 3.10"
|
11
|
+
gem "values", "~> 1"
|
12
|
+
end
|
13
|
+
|
14
|
+
# Excluded from CI except on latest MRI Ruby, to reduce compatibility burden
|
15
|
+
group :checks do
|
16
|
+
gem "codecov"
|
17
|
+
gem "panolint", github: "panorama-ed/panolint"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Excluded from CI except on latest MRI Ruby, to reduce compatibility burden
|
21
|
+
group :docs do
|
22
|
+
gem "redcarpet", "~> 3.5"
|
23
|
+
gem "yard", "~> 0.9"
|
24
|
+
gem "yard-doctest", "~> 0.1"
|
25
|
+
end
|
26
|
+
|
27
|
+
# Optional, only used locally to release to rubygems.org
|
28
|
+
group :release, optional: true do
|
29
|
+
gem "rake"
|
30
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/panorama-ed/panolint.git
|
3
|
+
revision: ca5edaa1f6985e2812998a937229f972c07bce56
|
4
|
+
specs:
|
5
|
+
panolint (0.1.2)
|
6
|
+
brakeman (>= 4.8, < 6.0)
|
7
|
+
rubocop (>= 0.83, < 2.0)
|
8
|
+
rubocop-performance (~> 1.5)
|
9
|
+
rubocop-rails (~> 2.5)
|
10
|
+
rubocop-rake (~> 0.5)
|
11
|
+
rubocop-rspec (~> 2.0)
|
12
|
+
|
13
|
+
PATH
|
14
|
+
remote: .
|
15
|
+
specs:
|
16
|
+
memo_wise (0.3.0)
|
17
|
+
|
18
|
+
GEM
|
19
|
+
remote: https://rubygems.org/
|
20
|
+
specs:
|
21
|
+
activesupport (5.2.4.4)
|
22
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
23
|
+
i18n (>= 0.7, < 2)
|
24
|
+
minitest (~> 5.1)
|
25
|
+
tzinfo (~> 1.1)
|
26
|
+
ast (2.4.2)
|
27
|
+
brakeman (5.0.0)
|
28
|
+
codecov (0.4.3)
|
29
|
+
simplecov (>= 0.15, < 0.22)
|
30
|
+
concurrent-ruby (1.1.8)
|
31
|
+
diff-lcs (1.4.4)
|
32
|
+
docile (1.3.5)
|
33
|
+
i18n (1.8.8)
|
34
|
+
concurrent-ruby (~> 1.0)
|
35
|
+
minitest (5.14.3)
|
36
|
+
parallel (1.20.1)
|
37
|
+
parser (3.0.0.0)
|
38
|
+
ast (~> 2.4.1)
|
39
|
+
rack (2.2.3)
|
40
|
+
rainbow (3.0.0)
|
41
|
+
rake (13.0.3)
|
42
|
+
redcarpet (3.5.1)
|
43
|
+
regexp_parser (2.0.3)
|
44
|
+
rexml (3.2.4)
|
45
|
+
rspec (3.10.0)
|
46
|
+
rspec-core (~> 3.10.0)
|
47
|
+
rspec-expectations (~> 3.10.0)
|
48
|
+
rspec-mocks (~> 3.10.0)
|
49
|
+
rspec-core (3.10.0)
|
50
|
+
rspec-support (~> 3.10.0)
|
51
|
+
rspec-expectations (3.10.0)
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
+
rspec-support (~> 3.10.0)
|
54
|
+
rspec-mocks (3.10.0)
|
55
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
56
|
+
rspec-support (~> 3.10.0)
|
57
|
+
rspec-support (3.10.0)
|
58
|
+
rubocop (1.9.1)
|
59
|
+
parallel (~> 1.10)
|
60
|
+
parser (>= 3.0.0.0)
|
61
|
+
rainbow (>= 2.2.2, < 4.0)
|
62
|
+
regexp_parser (>= 1.8, < 3.0)
|
63
|
+
rexml
|
64
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
65
|
+
ruby-progressbar (~> 1.7)
|
66
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
67
|
+
rubocop-ast (1.4.1)
|
68
|
+
parser (>= 2.7.1.5)
|
69
|
+
rubocop-performance (1.9.2)
|
70
|
+
rubocop (>= 0.90.0, < 2.0)
|
71
|
+
rubocop-ast (>= 0.4.0)
|
72
|
+
rubocop-rails (2.9.1)
|
73
|
+
activesupport (>= 4.2.0)
|
74
|
+
rack (>= 1.1)
|
75
|
+
rubocop (>= 0.90.0, < 2.0)
|
76
|
+
rubocop-rake (0.5.1)
|
77
|
+
rubocop
|
78
|
+
rubocop-rspec (2.2.0)
|
79
|
+
rubocop (~> 1.0)
|
80
|
+
rubocop-ast (>= 1.1.0)
|
81
|
+
ruby-progressbar (1.11.0)
|
82
|
+
simplecov (0.18.5)
|
83
|
+
docile (~> 1.1)
|
84
|
+
simplecov-html (~> 0.11)
|
85
|
+
simplecov-html (0.12.3)
|
86
|
+
thread_safe (0.3.6)
|
87
|
+
tzinfo (1.2.9)
|
88
|
+
thread_safe (~> 0.1)
|
89
|
+
unicode-display_width (2.0.0)
|
90
|
+
values (1.8.0)
|
91
|
+
yard (0.9.26)
|
92
|
+
yard-doctest (0.1.17)
|
93
|
+
minitest
|
94
|
+
yard
|
95
|
+
|
96
|
+
PLATFORMS
|
97
|
+
ruby
|
98
|
+
|
99
|
+
DEPENDENCIES
|
100
|
+
codecov
|
101
|
+
memo_wise!
|
102
|
+
panolint!
|
103
|
+
rake
|
104
|
+
redcarpet (~> 3.5)
|
105
|
+
rspec (~> 3.10)
|
106
|
+
values (~> 1)
|
107
|
+
yard (~> 0.9)
|
108
|
+
yard-doctest (~> 0.1)
|
109
|
+
|
110
|
+
BUNDLED WITH
|
111
|
+
2.2.3
|