Class: ImmutableStructExRedactable::Configuration
- Inherits:
-
Object
- Object
- ImmutableStructExRedactable::Configuration
- Defined in:
- lib/immutable_struct_ex_redactable/configuration.rb
Overview
This class encapsulates the configuration properties for this gem and provides methods and attributes that allow for management of the same.
Instance Attribute Summary collapse
-
#blacklist ⇒ Array<Symbol>
(also: #redacted)
Gets/sets the blacklisted fields that should be redacted for this gem.
-
#redacted_label ⇒ String
Gets/sets the label that should replace redacted field values.
-
#redacted_unsafe ⇒ Bool
Gets/sets the redacted unsafe switch that determines whether or not redacted field values are retained as private methods named #unredacted_<field> on the struct returned.
-
#whitelist ⇒ Array<Symbol>
Gets/sets the whitelisted fields that should not be redacted for this gem.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
The constructor; calls #reset.
- #redacted_unsafe? ⇒ Boolean
-
#reset ⇒ void
Resets the configuration settings to their default values.
Constructor Details
#initialize ⇒ Configuration
The constructor; calls #reset.
62 63 64 |
# File 'lib/immutable_struct_ex_redactable/configuration.rb', line 62 def initialize reset end |
Instance Attribute Details
#blacklist ⇒ Array<Symbol> Also known as: redacted
Gets/sets the blacklisted fields that should be redacted for this gem.
The default is %i.
32 33 34 |
# File 'lib/immutable_struct_ex_redactable/configuration.rb', line 32 def blacklist @blacklist end |
#redacted_label ⇒ String
Gets/sets the label that should replace redacted field values.
The default is “******”.
48 49 50 |
# File 'lib/immutable_struct_ex_redactable/configuration.rb', line 48 def redacted_label @redacted_label end |
#redacted_unsafe ⇒ Bool
Gets/sets the redacted unsafe switch that determines whether or not redacted field values are retained as private methods named #unredacted_<field> on the struct returned. If this configuration property is true, redacted field values will be retained and accessible as private methods on the struct.
The default is false.
59 60 61 |
# File 'lib/immutable_struct_ex_redactable/configuration.rb', line 59 def redacted_unsafe @redacted_unsafe end |
#whitelist ⇒ Array<Symbol>
Gets/sets the whitelisted fields that should not be redacted for this gem.
The default is [].
41 42 43 |
# File 'lib/immutable_struct_ex_redactable/configuration.rb', line 41 def whitelist @whitelist end |
Instance Method Details
#redacted_unsafe? ⇒ Boolean
66 67 68 |
# File 'lib/immutable_struct_ex_redactable/configuration.rb', line 66 def redacted_unsafe? @redacted_unsafe end |
#reset ⇒ void
This method returns an undefined value.
Resets the configuration settings to their default values.
73 74 75 76 77 78 |
# File 'lib/immutable_struct_ex_redactable/configuration.rb', line 73 def reset @blacklist = %i[password] @whitelist = [] @redacted_label = '******' @redacted_unsafe = false end |