Class: WipeOut::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/wipe_out/config.rb

Overview

Holds configuration for the gem.

Configuration options:

  • ignored_attributes - default: %i[id updated_at created_at archived_at] these attributes will be ignored in every plan by default.
  • logger - default: Rails.logger
  • default_on_execute - default: calls save! on record

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



15
16
17
18
19
# File 'lib/wipe_out/config.rb', line 15

def initialize
  @default_on_execute = ->(execution) { execution.record.save! }
  @ignored_attributes = %i[id updated_at created_at archived_at]
  @logger = Rails.logger
end

Instance Method Details

#dupObject

Duplicates config



22
23
24
25
26
27
28
# File 'lib/wipe_out/config.rb', line 22

def dup
  config = self.class.new
  config.ignored_attributes = ignored_attributes
  config.logger = logger
  config.default_on_execute = default_on_execute
  config
end