immutable_struct_ex_redactable 1.3.3 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +18 -1
- data/Gemfile +9 -6
- data/Gemfile.lock +61 -17
- data/README.md +4 -9
- data/lib/immutable_struct_ex_redactable/redacted_accessible.rb +13 -16
- data/lib/immutable_struct_ex_redactable/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f94f95a1a41ffeeac4aa337656c67806605ca4248182b17bc596ef6e29e34181
|
4
|
+
data.tar.gz: cdad5b9ca3f59488f9a011dd1b7ea3268cbf7c049fc9418107f2e09fe30eb5bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10f74495673aee8e3f16fcb8e5d599007160267db6c6d4e24dd952c9e6d8a2a95427be22c61f007889ec46b2e8c209f22772b152c438cb1478b1b44c6b77d577
|
7
|
+
data.tar.gz: 3335e9926530ac235d0b3a94b006bc87328368f52ac953a0c4577c1c46015d315e822310032c9ef7dffe63f0f0bceddf4dd5ffdb7fa880c89953ec812ca74a4a
|
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,26 @@
|
|
1
|
+
## [1.3.5] - 2024-01-07
|
2
|
+
|
3
|
+
Changes
|
4
|
+
|
5
|
+
- Relax ruby version requirement to Gem::Requirement.new(">= 3.0.1", "< 4.0").
|
6
|
+
- Ruby gem updates.
|
7
|
+
|
8
|
+
## [1.3.4] - 2023-12-27
|
9
|
+
|
10
|
+
Changes
|
11
|
+
|
12
|
+
- Add github actions to run tests and rubocop.
|
13
|
+
- DRY up code in immutable_struct_ex_redactable/redacted_accessible.rb.
|
14
|
+
- Ruby gem updates.
|
15
|
+
- Fix rubocop violations.
|
16
|
+
- Add some rubocop rules.
|
17
|
+
|
1
18
|
## [1.3.3] - 2023-12-02
|
2
19
|
|
3
20
|
Changes
|
4
21
|
|
5
22
|
- Ruby gem updates.
|
6
|
-
- Fix rubocop violations
|
23
|
+
- Fix rubocop violations.
|
7
24
|
|
8
25
|
## [1.3.2] - 2023-12-02
|
9
26
|
|
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,23 +1,51 @@
|
|
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.5)
|
5
|
+
immutable_struct_ex (~> 1.0, >= 1.0.5)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
|
+
bigdecimal (3.1.5)
|
11
12
|
byebug (11.1.3)
|
12
13
|
coderay (1.1.3)
|
14
|
+
concurrent-ruby (1.2.2)
|
13
15
|
diff-lcs (1.5.0)
|
14
16
|
docile (1.4.0)
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
dry-configurable (1.1.0)
|
18
|
+
dry-core (~> 1.0, < 2)
|
19
|
+
zeitwerk (~> 2.6)
|
20
|
+
dry-core (1.0.1)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
zeitwerk (~> 2.6)
|
23
|
+
dry-inflector (1.0.0)
|
24
|
+
dry-initializer (3.1.1)
|
25
|
+
dry-logic (1.5.0)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
dry-core (~> 1.0, < 2)
|
28
|
+
zeitwerk (~> 2.6)
|
29
|
+
dry-schema (1.13.3)
|
30
|
+
concurrent-ruby (~> 1.0)
|
31
|
+
dry-configurable (~> 1.0, >= 1.0.1)
|
32
|
+
dry-core (~> 1.0, < 2)
|
33
|
+
dry-initializer (~> 3.0)
|
34
|
+
dry-logic (>= 1.4, < 2)
|
35
|
+
dry-types (>= 1.7, < 2)
|
36
|
+
zeitwerk (~> 2.6)
|
37
|
+
dry-types (1.7.2)
|
38
|
+
bigdecimal (~> 3.0)
|
39
|
+
concurrent-ruby (~> 1.0)
|
40
|
+
dry-core (~> 1.0)
|
41
|
+
dry-inflector (~> 1.0)
|
42
|
+
dry-logic (~> 1.4)
|
43
|
+
zeitwerk (~> 2.6)
|
44
|
+
immutable_struct_ex (1.0.5)
|
45
|
+
json (2.7.1)
|
18
46
|
language_server-protocol (3.17.0.3)
|
19
47
|
method_source (1.0.0)
|
20
|
-
parallel (1.
|
48
|
+
parallel (1.24.0)
|
21
49
|
parser (3.2.2.4)
|
22
50
|
ast (~> 2.4.1)
|
23
51
|
racc
|
@@ -30,11 +58,12 @@ GEM
|
|
30
58
|
racc (1.7.3)
|
31
59
|
rainbow (3.1.1)
|
32
60
|
rake (13.1.0)
|
33
|
-
reek (6.
|
34
|
-
|
61
|
+
reek (6.2.0)
|
62
|
+
dry-schema (~> 1.13.0)
|
35
63
|
parser (~> 3.2.0)
|
36
64
|
rainbow (>= 2.0, < 4.0)
|
37
|
-
|
65
|
+
rexml (~> 3.1)
|
66
|
+
regexp_parser (2.8.3)
|
38
67
|
rexml (3.2.6)
|
39
68
|
rspec (3.12.0)
|
40
69
|
rspec-core (~> 3.12.0)
|
@@ -49,7 +78,7 @@ GEM
|
|
49
78
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
79
|
rspec-support (~> 3.12.0)
|
51
80
|
rspec-support (3.12.1)
|
52
|
-
rubocop (1.
|
81
|
+
rubocop (1.59.0)
|
53
82
|
json (~> 2.3)
|
54
83
|
language_server-protocol (>= 3.17.0)
|
55
84
|
parallel (~> 1.10)
|
@@ -62,6 +91,17 @@ GEM
|
|
62
91
|
unicode-display_width (>= 2.4.0, < 3.0)
|
63
92
|
rubocop-ast (1.30.0)
|
64
93
|
parser (>= 3.2.1.0)
|
94
|
+
rubocop-capybara (2.20.0)
|
95
|
+
rubocop (~> 1.41)
|
96
|
+
rubocop-factory_bot (2.25.0)
|
97
|
+
rubocop (~> 1.33)
|
98
|
+
rubocop-performance (1.20.1)
|
99
|
+
rubocop (>= 1.48.1, < 2.0)
|
100
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
101
|
+
rubocop-rspec (2.26.1)
|
102
|
+
rubocop (~> 1.40)
|
103
|
+
rubocop-capybara (~> 2.17)
|
104
|
+
rubocop-factory_bot (~> 2.22)
|
65
105
|
ruby-progressbar (1.13.0)
|
66
106
|
simplecov (0.22.0)
|
67
107
|
docile (~> 1.1)
|
@@ -70,6 +110,7 @@ GEM
|
|
70
110
|
simplecov-html (0.12.3)
|
71
111
|
simplecov_json_formatter (0.1.4)
|
72
112
|
unicode-display_width (2.5.0)
|
113
|
+
zeitwerk (2.6.12)
|
73
114
|
|
74
115
|
PLATFORMS
|
75
116
|
x86_64-darwin-19
|
@@ -77,13 +118,16 @@ PLATFORMS
|
|
77
118
|
x86_64-linux
|
78
119
|
|
79
120
|
DEPENDENCIES
|
121
|
+
bundler (~> 2.4, >= 2.4.21)
|
80
122
|
immutable_struct_ex_redactable!
|
81
|
-
pry-byebug (
|
82
|
-
rake (~> 13.0)
|
83
|
-
reek (~> 6.1)
|
84
|
-
rspec (>= 3.
|
85
|
-
rubocop (
|
86
|
-
|
123
|
+
pry-byebug (~> 3.9)
|
124
|
+
rake (~> 13.0, >= 13.0.6)
|
125
|
+
reek (~> 6.1, >= 6.1.1)
|
126
|
+
rspec (>= 3.10)
|
127
|
+
rubocop (~> 1.35)
|
128
|
+
rubocop-performance (~> 1.14, >= 1.14.3)
|
129
|
+
rubocop-rspec (~> 2.12, >= 2.12.1)
|
130
|
+
simplecov (~> 0.22.0)
|
87
131
|
|
88
132
|
BUNDLED WITH
|
89
|
-
2.3
|
133
|
+
2.5.3
|
data/README.md
CHANGED
@@ -1,14 +1,9 @@
|
|
1
1
|
# `immutable_struct_ex_redactable`
|
2
2
|
|
3
|
-
[![
|
4
|
-
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/immutable_struct_ex_redactable.svg)](https://badge.fury.io/rb/immutable_struct_ex_redactable)
|
6
|
-
|
7
|
-
[![](http://ruby-gem-downloads-badge.herokuapp.com/immutable_struct_ex_redactable?type=total)](http://www.rubydoc.info/gems/immutable_struct_ex_redactable/)
|
8
|
-
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/immutable_struct_ex_redactable/)
|
9
|
-
|
10
|
-
[![Report Issues](https://img.shields.io/badge/report-issues-red.svg)](https://github.com/gangelo/immutable_struct_ex_redactable/issues)
|
11
|
-
|
3
|
+
[![Ruby](https://github.com/gangelo/immutable_struct_ex_redactable/actions/workflows/ruby.yml/badge.svg)](https://github.com/gangelo/immutable_struct_ex_redactable/actions/workflows/ruby.yml)
|
4
|
+
[![GitHub version](http://badge.fury.io/gh/gangelo%2Fimmutable_struct_ex_redactable.svg?version=2)](https://badge.fury.io/gh/gangelo%2Fimmutable_struct_ex_redactable)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/immutable_struct_ex_redactable.svg?version=2)](https://badge.fury.io/rb/immutable_struct_ex_redactable)
|
6
|
+
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/immutable_struct_ex_redactable/) [![Report Issues](https://img.shields.io/badge/report-issues-red.svg)](https://github.com/gangelo/immutable_struct_ex_redactable/issues)
|
12
7
|
[![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#license)
|
13
8
|
|
14
9
|
## Introduction
|
@@ -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.5
|
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:
|
11
|
+
date: 2024-01-07 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:
|
@@ -79,6 +79,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: 3.0.1
|
82
|
+
- - "<"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '4.0'
|
82
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
86
|
requirements:
|
84
87
|
- - ">="
|