Class: DumpCleaner::Cleanup::CleaningSteps::FillUpWithString

Inherits:
Base
  • Object
show all
Includes:
BytesizeHelpers
Defined in:
lib/dump_cleaner/cleanup/cleaning_steps/fill_up_with_string.rb

Instance Attribute Summary

Attributes inherited from Base

#step_context

Instance Method Summary collapse

Methods included from BytesizeHelpers

#replace_suffix, #set_to_bytesize, #truncate_to_bytesize

Methods inherited from Base

#crc32, #initialize, #raise_params_error

Constructor Details

This class inherits a constructor from DumpCleaner::Cleanup::CleaningSteps::Base

Instance Method Details

#run(string: "anonymized #{type}", padding: " ", strict_bytesize_check: false) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/dump_cleaner/cleanup/cleaning_steps/fill_up_with_string.rb', line 9

def run(string: "anonymized #{type}", padding: " ", strict_bytesize_check: false)
  if strict_bytesize_check && string.bytesize != orig_value.bytesize
    raise "The bytesize of the string must be equal to the bytesize of the original value."
  end

  string = set_to_bytesize(string, bytesize: orig_value.bytesize, padding:)
  AddRepetitionSuffix.new(StepContext.new_from(step_context, current_value: string)).run
end