redaction 0.3.0 → 0.4.0

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: 8bc14b33dd2b915ffb1af50537fa036024284e7d25b5d684b005ccfc43912062
4
- data.tar.gz: faee2e5e5768ac841c6b72fcf6d51fced89cbae9bb79b326751581619e624404
3
+ metadata.gz: d9ba1c11cd9618292859be01f037bb64da083a5873020ea489ab07e5f54411b2
4
+ data.tar.gz: 85f6bc9d21d79b37a9d061d002e1fec8b00841dd135b1d40a6b1d1c5146d891d
5
5
  SHA512:
6
- metadata.gz: 2dfaf94ee151f629d748d83ce8c31d1892cefbccf686e3fab4df66faafc0b6b31cc59d8a00f8cceb4aaf20b57b2ce19a609c10da1a7194bcfc91f20a6c289614
7
- data.tar.gz: d881259bd6d4193c175dbbf8bf81d2c3d5defd015c98b33d94685e03f83f5da1c05c7fbf19c4dbeba95018251842a16316b2cdaea554735e1deaf5c7fc69dfea
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)
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Redaction
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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-05-20 00:00:00.000000000 Z
11
+ date: 2022-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails