Class: DumpCleaner::Cleanup::DataSourceSteps::GroupByBytesize
- Defined in:
- lib/dump_cleaner/cleanup/data_source_steps/group_by_bytesize.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#initialize, #raise_params_error
Constructor Details
This class inherits a constructor from DumpCleaner::Cleanup::DataSourceSteps::Base
Instance Method Details
#run(under_keys: []) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dump_cleaner/cleanup/data_source_steps/group_by_bytesize.rb', line 7 def run(under_keys: []) validate_params(under_keys:) group_by_lambda = -> { "#{_1.length}-#{_1.bytesize}" } step_context.cleanup_data = begin if under_keys.any? new_data = cleanup_data.dup under_keys.each do |key| new_data[key] = new_data[key].group_by(&group_by_lambda) end new_data else cleanup_data.group_by(&group_by_lambda) end end step_context end |