Class: DumpCleaner::Cleanup::CleaningSteps::Base

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/dump_cleaner/cleanup/cleaning_steps/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step_context) ⇒ Base

Returns a new instance of Base.



16
17
18
# File 'lib/dump_cleaner/cleanup/cleaning_steps/base.rb', line 16

def initialize(step_context)
  @step_context = step_context.dup
end

Instance Attribute Details

#step_contextObject (readonly)

Returns the value of attribute step_context.



14
15
16
# File 'lib/dump_cleaner/cleanup/cleaning_steps/base.rb', line 14

def step_context
  @step_context
end

Instance Method Details

#crc32(use_repetition: true) ⇒ Object



20
21
22
23
24
# File 'lib/dump_cleaner/cleanup/cleaning_steps/base.rb', line 20

def crc32(use_repetition: true)
  value_to_hash = "#{record['id_column']}-#{current_value}"
  value_to_hash += "-#{repetition}" if repetition.positive? && use_repetition
  Zlib.crc32(value_to_hash)
end

#raise_params_error(error) ⇒ Object

Raises:

  • (ArgumentError)


26
27
28
29
# File 'lib/dump_cleaner/cleanup/cleaning_steps/base.rb', line 26

def raise_params_error(error)
  step = self.class.name.split("::").last
  raise ArgumentError, "Invalid cleanup step params: type=#{type}, step=#{step}: #{error}"
end