Class: DumpCleaner::Cleaners::BaseCleaner

Inherits:
Object
  • Object
show all
Defined in:
lib/dump_cleaner/cleaners/base_cleaner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:, options:) ⇒ BaseCleaner

Returns a new instance of BaseCleaner.



8
9
10
11
# File 'lib/dump_cleaner/cleaners/base_cleaner.rb', line 8

def initialize(config:, options:)
  @config = config
  @options = options
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/dump_cleaner/cleaners/base_cleaner.rb', line 6

def config
  @config
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/dump_cleaner/cleaners/base_cleaner.rb', line 6

def options
  @options
end

Instance Method Details

#cleanObject

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/dump_cleaner/cleaners/base_cleaner.rb', line 17

def clean
  raise NotImplementedError
end

#keep_same_record?(record, table_config:) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
# File 'lib/dump_cleaner/cleaners/base_cleaner.rb', line 25

def keep_same_record?(record, table_config:)
  return false unless table_config.keep_same_record_conditions

  Conditions.new(table_config.keep_same_record_conditions).evaluate_to_true?(record:)
end

#post_cleanupObject



21
22
23
# File 'lib/dump_cleaner/cleaners/base_cleaner.rb', line 21

def post_cleanup
  # Implement in subclass if needed
end

#pre_cleanupObject



13
14
15
# File 'lib/dump_cleaner/cleaners/base_cleaner.rb', line 13

def pre_cleanup
  # Implement in subclass if needed
end