Class: PiiSafeSchema::Configuration
- Inherits:
-
Object
- Object
- PiiSafeSchema::Configuration
- Defined in:
- lib/pii_safe_schema/configuration.rb
Constant Summary collapse
- DEFAULT_IGNORE =
{ schema_migrations: :*, ar_internal_metadata: :*, }.freeze
- KNOWN_DD_CLIENTS =
%w[DataDogClient Ws::Railway::Datadog].freeze
Instance Method Summary collapse
- #datadog_client ⇒ Object
- #datadog_client=(client) ⇒ Object
- #ignore ⇒ Object
- #ignore=(ignore_params) ⇒ Object
- #ignore_columns ⇒ Object
- #ignore_tables ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 |
# File 'lib/pii_safe_schema/configuration.rb', line 10 def initialize @user_ignore = {} end |
Instance Method Details
#datadog_client ⇒ Object
29 30 31 32 33 34 |
# File 'lib/pii_safe_schema/configuration.rb', line 29 def datadog_client @datadog_client ||= KNOWN_DD_CLIENTS.find do |client| client.safe_constantize if defined?(client) end end |
#datadog_client=(client) ⇒ Object
23 24 25 26 27 |
# File 'lib/pii_safe_schema/configuration.rb', line 23 def datadog_client=(client) raise_config_error(:datadog_client) if client.present? && !client.respond_to?(:event) @datadog_client = client end |
#ignore ⇒ Object
19 20 21 |
# File 'lib/pii_safe_schema/configuration.rb', line 19 def ignore @user_ignore.merge(DEFAULT_IGNORE) end |
#ignore=(ignore_params) ⇒ Object
14 15 16 17 |
# File 'lib/pii_safe_schema/configuration.rb', line 14 def ignore=(ignore_params) validate_ignore(ignore_params) @user_ignore = ignore_params end |
#ignore_columns ⇒ Object
40 41 42 |
# File 'lib/pii_safe_schema/configuration.rb', line 40 def ignore_columns ignore.select { |_k, v| v.is_a?(Array) } end |
#ignore_tables ⇒ Object
36 37 38 |
# File 'lib/pii_safe_schema/configuration.rb', line 36 def ignore_tables ignore.select { |_k, v| v.to_s == '*' }.keys.map(&:to_s) end |