immutable_struct_ex_redactable 1.3.2 → 1.3.4

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: 9240412d92b6448641e2581a54e4f96763801caf082084893f0295041dc349ef
4
- data.tar.gz: d8ac366109c33d57914df6641363455a882ba04f48de24a25c24460ea3875b85
3
+ metadata.gz: 513a14fe6adbe75b761cec89f28ba1528c3001224a22da963bbe2c942d12f400
4
+ data.tar.gz: 534bed4b462d529d81e551ecfd3edab852766e42ca7f00ca44275192dea83e33
5
5
  SHA512:
6
- metadata.gz: 736110db9963c597d6a8808452db7ee374d41bb08eb35531ac0870fd4309cfd025aae54c1dc89434118202b4c8d043946a704931a9e532a8dfe72b3799d56c4d
7
- data.tar.gz: aa63628e6c0aceb4f52d71519b88dc286830835ec41bc6828b7436741243eacb5116261c42bb72af0a76f9f178f70777bb5da393e15dbc45fb36804559b3e47f
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,3 +1,20 @@
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
+
11
+ ## [1.3.3] - 2023-12-02
12
+
13
+ Changes
14
+
15
+ - Ruby gem updates.
16
+ - Fix rubocop violations.
17
+
1
18
  ## [1.3.2] - 2023-12-02
2
19
 
3
20
  Changes
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 'bundler', '~> 2.4', '>= 2.4.21'
8
9
  gem 'pry-byebug', '~> 3.9'
9
- gem 'rake', '~> 13.0'
10
- gem 'reek', '~> 6.1'
11
- gem 'rspec', '~> 3.12'
12
- gem 'rubocop', '~> 1.56.0'
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'
13
16
  gem 'simplecov', '~> 0.22.0'
data/Gemfile.lock CHANGED
@@ -1,24 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- immutable_struct_ex_redactable (1.3.2)
5
- immutable_struct_ex (~> 1.0, >= 1.0.1)
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/
9
9
  specs:
10
10
  ast (2.4.2)
11
- base64 (0.1.1)
12
11
  byebug (11.1.3)
13
12
  coderay (1.1.3)
14
13
  diff-lcs (1.5.0)
15
14
  docile (1.4.0)
16
- immutable_struct_ex (1.0.4)
17
- json (2.7.0)
15
+ immutable_struct_ex (1.0.5)
16
+ json (2.7.1)
18
17
  kwalify (0.7.2)
19
18
  language_server-protocol (3.17.0.3)
20
19
  method_source (1.0.0)
21
- parallel (1.23.0)
20
+ parallel (1.24.0)
22
21
  parser (3.2.2.4)
23
22
  ast (~> 2.4.1)
24
23
  racc
@@ -35,7 +34,7 @@ GEM
35
34
  kwalify (~> 0.7.0)
36
35
  parser (~> 3.2.0)
37
36
  rainbow (>= 2.0, < 4.0)
38
- regexp_parser (2.8.2)
37
+ regexp_parser (2.8.3)
39
38
  rexml (3.2.6)
40
39
  rspec (3.12.0)
41
40
  rspec-core (~> 3.12.0)
@@ -50,20 +49,30 @@ GEM
50
49
  diff-lcs (>= 1.2.0, < 2.0)
51
50
  rspec-support (~> 3.12.0)
52
51
  rspec-support (3.12.1)
53
- rubocop (1.56.4)
54
- base64 (~> 0.1.1)
52
+ rubocop (1.59.0)
55
53
  json (~> 2.3)
56
54
  language_server-protocol (>= 3.17.0)
57
55
  parallel (~> 1.10)
58
- parser (>= 3.2.2.3)
56
+ parser (>= 3.2.2.4)
59
57
  rainbow (>= 2.2.2, < 4.0)
60
58
  regexp_parser (>= 1.8, < 3.0)
61
59
  rexml (>= 3.2.5, < 4.0)
62
- rubocop-ast (>= 1.28.1, < 2.0)
60
+ rubocop-ast (>= 1.30.0, < 2.0)
63
61
  ruby-progressbar (~> 1.7)
64
62
  unicode-display_width (>= 2.4.0, < 3.0)
65
63
  rubocop-ast (1.30.0)
66
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)
67
76
  ruby-progressbar (1.13.0)
68
77
  simplecov (0.22.0)
69
78
  docile (~> 1.1)
@@ -79,13 +88,16 @@ PLATFORMS
79
88
  x86_64-linux
80
89
 
81
90
  DEPENDENCIES
91
+ bundler (~> 2.4, >= 2.4.21)
82
92
  immutable_struct_ex_redactable!
83
93
  pry-byebug (~> 3.9)
84
- rake (~> 13.0)
85
- reek (~> 6.1)
86
- rspec (~> 3.12)
87
- rubocop (~> 1.56.0)
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)
88
100
  simplecov (~> 0.22.0)
89
101
 
90
102
  BUNDLED WITH
91
- 2.3.22
103
+ 2.5.3
data/README.md CHANGED
@@ -1,15 +1,6 @@
1
1
  # `immutable_struct_ex_redactable`
2
2
 
3
- [![GitHub version](http://badge.fury.io/gh/gangelo%2Fimmutable_struct_ex_redactable.svg)](https://badge.fury.io/gh/gangelo%2Fimmutable_struct_ex_redactable)
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
-
12
- [![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#license)
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) [![GitHub version](http://badge.fury.io/gh/gangelo%2Fimmutable_struct_ex_redactable.svg?version=1)](https://badge.fury.io/gh/gangelo%2Fimmutable_struct_ex_redactable) [![Gem Version](https://badge.fury.io/rb/immutable_struct_ex_redactable.svg?version=1)](https://badge.fury.io/rb/immutable_struct_ex_redactable) [![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) [![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#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
- hash.each do |attr, _|
16
+ hash.each_key do |attr|
16
17
  next if config.whitelist.include? attr
17
18
 
18
- unredacted_attr_method = "unredacted_#{attr}"
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
- unredacted_attr_method = "unredacted_#{attr}"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ImmutableStructExRedactable
4
- VERSION = '1.3.2'
4
+ VERSION = '1.3.4'
5
5
  end
@@ -22,7 +22,7 @@ module ImmutableStructExRedactable
22
22
  end
23
23
 
24
24
  if config.whitelist.any?
25
- hash.each do |key, _|
25
+ hash.each_key do |key|
26
26
  next if config.whitelist.include? key
27
27
 
28
28
  hash[key] = config.redacted_label
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.2
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-02 00:00:00.000000000 Z
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.1
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.1
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: