Class: DumpCleaner::Cleanup::CleaningSteps::Base
- Inherits:
-
Object
- Object
- DumpCleaner::Cleanup::CleaningSteps::Base
- Extended by:
- Forwardable
- Defined in:
- lib/dump_cleaner/cleanup/cleaning_steps/base.rb
Direct Known Subclasses
AddRepetitionSuffix, FillUpWithString, GenerateRandomString, InspectContext, RandomizeEmail, RandomizeFormattedNumber, RandomizeNumber, SelectDataByBytesize, SelectDataByPattern, TakeSample
Instance Attribute Summary collapse
-
#step_context ⇒ Object
readonly
Returns the value of attribute step_context.
Instance Method Summary collapse
- #crc32(use_repetition: true) ⇒ Object
-
#initialize(step_context) ⇒ Base
constructor
A new instance of Base.
- #raise_params_error(error) ⇒ Object
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_context ⇒ Object (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
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 |