Module: Kiba::Extend::Transforms::Allable

Overview

Mixin module providing finalize_fields method for transforms that accept fields: :all.

Usage

Any transform classes mixing in this module must have @fields as an instance variable and fields as an attr_reader.

Set the fields instance variable from user input as follows:

 @fields = [fields].flatten

Add the following line as the first thing in the process method:

finalize_fields(row) unless fields_set

If there is an omit_from_all_fields attr_reader set, these fields will be removed from the finalized list of all fields.

Since:

  • 2.8.0