redaction 0.3.0 → 0.4.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 +4 -4
- data/README.md +10 -0
- data/lib/redaction/railtie.rb +1 -0
- data/lib/redaction/redactable.rb +1 -1
- data/lib/redaction/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9ba1c11cd9618292859be01f037bb64da083a5873020ea489ab07e5f54411b2
|
4
|
+
data.tar.gz: 85f6bc9d21d79b37a9d061d002e1fec8b00841dd135b1d40a6b1d1c5146d891d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29a8813e86d71875213d8ae10531ce9582a2c590c5918716339e035efbd2472b758822cb53fcafa79b356485208cdea72d64cf76d676c18761a91f92284cbe70
|
7
|
+
data.tar.gz: 27cbf2162fda8b3e0dc80aeecf477df6ea872adc8b6743b09c90e6153090b8707e0e85a68a96f0ca478d2d528796d7b0b9c5f99307f0d9760986aaba593deac9
|
data/README.md
CHANGED
@@ -114,6 +114,16 @@ class User < ApplicationRecord
|
|
114
114
|
end
|
115
115
|
```
|
116
116
|
|
117
|
+
### Configuration
|
118
|
+
Redaction has the following configuration options:
|
119
|
+
| Option | Default | Description |
|
120
|
+
|:------------|:------------|:------------|
|
121
|
+
| `email_domain` | `nil` | Set to a string to use a custom domain for redacted emails. i.e. `Redaction.config.email_domain = "my-domain.dev" |
|
122
|
+
| `progress_bar`| `true` | Set to false to not use the built in progress bar when redacting |
|
123
|
+
| `force_redaction` | `false` | Set to true to alway fill a column with redacted content even if the attribute is `nil` or empty |
|
124
|
+
|
125
|
+
It is reccomended that you put your configuration in an initializer like `config/initializers/redaction.rb`
|
126
|
+
|
117
127
|
## Roadmap
|
118
128
|
- [ ] Raise Error or at least a message when skipping a passed in Model
|
119
129
|
- [ ] Configuration (touch, email domains, etc)
|
data/lib/redaction/railtie.rb
CHANGED
@@ -13,6 +13,7 @@ module Redaction
|
|
13
13
|
|
14
14
|
options.email_domain = options.email_domain
|
15
15
|
options.progress_bar = options.key?(:progress_bar) ? options.progress_bar : true
|
16
|
+
options.force_redaction = options.key?(:force_redaction) ? options.force_redaction : false
|
16
17
|
|
17
18
|
ActiveSupport.on_load(:active_record) do
|
18
19
|
include Redaction::Redactable
|
data/lib/redaction/redactable.rb
CHANGED
@@ -17,7 +17,7 @@ module Redaction
|
|
17
17
|
redactor = Redaction.find(redactor_type)
|
18
18
|
|
19
19
|
attributes.each do |attribute|
|
20
|
-
if send(attribute).present?
|
20
|
+
if Redaction.config.force_redaction || send(attribute).present?
|
21
21
|
send("#{attribute}=", redactor.call(self, {attribute: attribute}))
|
22
22
|
end
|
23
23
|
end
|
data/lib/redaction/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Drew Bragg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|