immutable_struct_ex_redactable 1.3.3 → 1.3.4
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 +4 -4
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +11 -1
- data/Gemfile +9 -6
- data/Gemfile.lock +28 -14
- data/README.md +1 -10
- data/lib/immutable_struct_ex_redactable/redacted_accessible.rb +13 -16
- data/lib/immutable_struct_ex_redactable/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 513a14fe6adbe75b761cec89f28ba1528c3001224a22da963bbe2c942d12f400
|
|
4
|
+
data.tar.gz: 534bed4b462d529d81e551ecfd3edab852766e42ca7f00ca44275192dea83e33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 338ca6a91a1aad28d5efc5ae5590e8670f94250846617b31b1263b1ac663903cc8e8107eab14d75e1d4228c17a41b76488ca82b5ae630ed333202afe94b428b6
|
|
7
|
+
data.tar.gz: b06a44fce14f2fab25ecca9cad42678680ae1a85e1335b786e74a725a02661bbeb84d85aa80e22e82fb20c3cf8fd27eb18891af4ca00222cb49aecd9ab67376b
|
data/.rubocop.yml
CHANGED
|
@@ -184,3 +184,12 @@ Style/StringMethods:
|
|
|
184
184
|
# Checks for use of parentheses around ternary conditions.
|
|
185
185
|
Style/TernaryParentheses:
|
|
186
186
|
EnforcedStyle: require_parentheses_when_complex
|
|
187
|
+
|
|
188
|
+
NestedGroups:
|
|
189
|
+
Max: 4
|
|
190
|
+
|
|
191
|
+
MultipleMemoizedHelpers:
|
|
192
|
+
Max: 6
|
|
193
|
+
|
|
194
|
+
ExampleLength:
|
|
195
|
+
Max: 6
|
data/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
## [1.3.4] - 2023-12-27
|
|
2
|
+
|
|
3
|
+
Changes
|
|
4
|
+
|
|
5
|
+
- Add github actions to run tests and rubocop.
|
|
6
|
+
- DRY up code in immutable_struct_ex_redactable/redacted_accessible.rb.
|
|
7
|
+
- Ruby gem updates.
|
|
8
|
+
- Fix rubocop violations.
|
|
9
|
+
- Add some rubocop rules.
|
|
10
|
+
|
|
1
11
|
## [1.3.3] - 2023-12-02
|
|
2
12
|
|
|
3
13
|
Changes
|
|
4
14
|
|
|
5
15
|
- Ruby gem updates.
|
|
6
|
-
- Fix rubocop violations
|
|
16
|
+
- Fix rubocop violations.
|
|
7
17
|
|
|
8
18
|
## [1.3.2] - 2023-12-02
|
|
9
19
|
|
data/Gemfile
CHANGED
|
@@ -5,9 +5,12 @@ source 'https://rubygems.org'
|
|
|
5
5
|
# Specify your gem's dependencies in immutable_struct_ex_redactable.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem '
|
|
9
|
-
gem '
|
|
10
|
-
gem '
|
|
11
|
-
gem '
|
|
12
|
-
gem '
|
|
13
|
-
gem '
|
|
8
|
+
gem 'bundler', '~> 2.4', '>= 2.4.21'
|
|
9
|
+
gem 'pry-byebug', '~> 3.9'
|
|
10
|
+
gem 'rake', '~> 13.0', '>= 13.0.6'
|
|
11
|
+
gem 'reek', '~> 6.1', '>= 6.1.1'
|
|
12
|
+
gem 'rspec', '>= 3.10'
|
|
13
|
+
gem 'rubocop', '~> 1.35'
|
|
14
|
+
gem 'rubocop-performance', '~> 1.14', '>= 1.14.3'
|
|
15
|
+
gem 'rubocop-rspec', '~> 2.12', '>= 2.12.1'
|
|
16
|
+
gem 'simplecov', '~> 0.22.0'
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
immutable_struct_ex_redactable (1.3.
|
|
5
|
-
immutable_struct_ex (~> 1.0, >= 1.0.
|
|
4
|
+
immutable_struct_ex_redactable (1.3.4)
|
|
5
|
+
immutable_struct_ex (~> 1.0, >= 1.0.5)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
@@ -12,12 +12,12 @@ GEM
|
|
|
12
12
|
coderay (1.1.3)
|
|
13
13
|
diff-lcs (1.5.0)
|
|
14
14
|
docile (1.4.0)
|
|
15
|
-
immutable_struct_ex (1.0.
|
|
16
|
-
json (2.7.
|
|
15
|
+
immutable_struct_ex (1.0.5)
|
|
16
|
+
json (2.7.1)
|
|
17
17
|
kwalify (0.7.2)
|
|
18
18
|
language_server-protocol (3.17.0.3)
|
|
19
19
|
method_source (1.0.0)
|
|
20
|
-
parallel (1.
|
|
20
|
+
parallel (1.24.0)
|
|
21
21
|
parser (3.2.2.4)
|
|
22
22
|
ast (~> 2.4.1)
|
|
23
23
|
racc
|
|
@@ -34,7 +34,7 @@ GEM
|
|
|
34
34
|
kwalify (~> 0.7.0)
|
|
35
35
|
parser (~> 3.2.0)
|
|
36
36
|
rainbow (>= 2.0, < 4.0)
|
|
37
|
-
regexp_parser (2.8.
|
|
37
|
+
regexp_parser (2.8.3)
|
|
38
38
|
rexml (3.2.6)
|
|
39
39
|
rspec (3.12.0)
|
|
40
40
|
rspec-core (~> 3.12.0)
|
|
@@ -49,7 +49,7 @@ GEM
|
|
|
49
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
50
50
|
rspec-support (~> 3.12.0)
|
|
51
51
|
rspec-support (3.12.1)
|
|
52
|
-
rubocop (1.
|
|
52
|
+
rubocop (1.59.0)
|
|
53
53
|
json (~> 2.3)
|
|
54
54
|
language_server-protocol (>= 3.17.0)
|
|
55
55
|
parallel (~> 1.10)
|
|
@@ -62,6 +62,17 @@ GEM
|
|
|
62
62
|
unicode-display_width (>= 2.4.0, < 3.0)
|
|
63
63
|
rubocop-ast (1.30.0)
|
|
64
64
|
parser (>= 3.2.1.0)
|
|
65
|
+
rubocop-capybara (2.19.0)
|
|
66
|
+
rubocop (~> 1.41)
|
|
67
|
+
rubocop-factory_bot (2.24.0)
|
|
68
|
+
rubocop (~> 1.33)
|
|
69
|
+
rubocop-performance (1.20.1)
|
|
70
|
+
rubocop (>= 1.48.1, < 2.0)
|
|
71
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
|
72
|
+
rubocop-rspec (2.25.0)
|
|
73
|
+
rubocop (~> 1.40)
|
|
74
|
+
rubocop-capybara (~> 2.17)
|
|
75
|
+
rubocop-factory_bot (~> 2.22)
|
|
65
76
|
ruby-progressbar (1.13.0)
|
|
66
77
|
simplecov (0.22.0)
|
|
67
78
|
docile (~> 1.1)
|
|
@@ -77,13 +88,16 @@ PLATFORMS
|
|
|
77
88
|
x86_64-linux
|
|
78
89
|
|
|
79
90
|
DEPENDENCIES
|
|
91
|
+
bundler (~> 2.4, >= 2.4.21)
|
|
80
92
|
immutable_struct_ex_redactable!
|
|
81
|
-
pry-byebug (
|
|
82
|
-
rake (~> 13.0)
|
|
83
|
-
reek (~> 6.1)
|
|
84
|
-
rspec (>= 3.
|
|
85
|
-
rubocop (
|
|
86
|
-
|
|
93
|
+
pry-byebug (~> 3.9)
|
|
94
|
+
rake (~> 13.0, >= 13.0.6)
|
|
95
|
+
reek (~> 6.1, >= 6.1.1)
|
|
96
|
+
rspec (>= 3.10)
|
|
97
|
+
rubocop (~> 1.35)
|
|
98
|
+
rubocop-performance (~> 1.14, >= 1.14.3)
|
|
99
|
+
rubocop-rspec (~> 2.12, >= 2.12.1)
|
|
100
|
+
simplecov (~> 0.22.0)
|
|
87
101
|
|
|
88
102
|
BUNDLED WITH
|
|
89
|
-
2.3
|
|
103
|
+
2.5.3
|
data/README.md
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
# `immutable_struct_ex_redactable`
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/gh/gangelo%2Fimmutable_struct_ex_redactable)
|
|
4
|
-
|
|
5
|
-
[](https://badge.fury.io/rb/immutable_struct_ex_redactable)
|
|
6
|
-
|
|
7
|
-
[](http://www.rubydoc.info/gems/immutable_struct_ex_redactable/)
|
|
8
|
-
[](http://www.rubydoc.info/gems/immutable_struct_ex_redactable/)
|
|
9
|
-
|
|
10
|
-
[](https://github.com/gangelo/immutable_struct_ex_redactable/issues)
|
|
11
|
-
|
|
12
|
-
[](#license)
|
|
3
|
+
[](https://github.com/gangelo/immutable_struct_ex_redactable/actions/workflows/ruby.yml) [](https://badge.fury.io/gh/gangelo%2Fimmutable_struct_ex_redactable) [](https://badge.fury.io/rb/immutable_struct_ex_redactable) [](http://www.rubydoc.info/gems/immutable_struct_ex_redactable/) [](https://github.com/gangelo/immutable_struct_ex_redactable/issues) [](#license)
|
|
13
4
|
|
|
14
5
|
## Introduction
|
|
15
6
|
|
|
@@ -10,34 +10,31 @@ module ImmutableStructExRedactable
|
|
|
10
10
|
|
|
11
11
|
module ClassModules
|
|
12
12
|
def redacted_accessible_module_for(hash:, config:)
|
|
13
|
+
unredacted_method_proc = method(:unredacted_attr_method)
|
|
13
14
|
Module.new do
|
|
14
15
|
if config.whitelist.any?
|
|
15
16
|
hash.each_key do |attr|
|
|
16
17
|
next if config.whitelist.include? attr
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
code = <<~CODE
|
|
20
|
-
def #{unredacted_attr_method}
|
|
21
|
-
"#{hash[attr]}"
|
|
22
|
-
end
|
|
23
|
-
private :#{unredacted_attr_method}
|
|
24
|
-
CODE
|
|
25
|
-
class_eval code
|
|
19
|
+
class_eval unredacted_method_proc.call(attr: attr, hash: hash)
|
|
26
20
|
end
|
|
27
21
|
else
|
|
28
22
|
config.blacklist.each do |attr|
|
|
29
|
-
|
|
30
|
-
code = <<~CODE
|
|
31
|
-
def #{unredacted_attr_method}
|
|
32
|
-
"#{hash[attr]}"
|
|
33
|
-
end
|
|
34
|
-
private :#{unredacted_attr_method}
|
|
35
|
-
CODE
|
|
36
|
-
class_eval code
|
|
23
|
+
class_eval unredacted_method_proc.call(attr: attr, hash: hash)
|
|
37
24
|
end
|
|
38
25
|
end
|
|
39
26
|
end
|
|
40
27
|
end
|
|
28
|
+
|
|
29
|
+
def unredacted_attr_method(attr:, hash:)
|
|
30
|
+
unredacted_attr_method = "unredacted_#{attr}"
|
|
31
|
+
<<~CODE
|
|
32
|
+
def #{unredacted_attr_method}
|
|
33
|
+
"#{hash[attr]}"
|
|
34
|
+
end
|
|
35
|
+
private :#{unredacted_attr_method}
|
|
36
|
+
CODE
|
|
37
|
+
end
|
|
41
38
|
end
|
|
42
39
|
end
|
|
43
40
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: immutable_struct_ex_redactable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gene M. Angelo, Jr.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-12-
|
|
11
|
+
date: 2023-12-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: immutable_struct_ex
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
version: '1.0'
|
|
20
20
|
- - ">="
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 1.0.
|
|
22
|
+
version: 1.0.5
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +29,7 @@ dependencies:
|
|
|
29
29
|
version: '1.0'
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 1.0.
|
|
32
|
+
version: 1.0.5
|
|
33
33
|
description: Creates and initializes an immutable struct in one step and provides
|
|
34
34
|
redaction functionality.
|
|
35
35
|
email:
|