Class: Chronicle::ETL::FieldsLimitTransformer
- Inherits:
-
Transformer
- Object
- Transformer
- Chronicle::ETL::FieldsLimitTransformer
- Defined in:
- lib/chronicle/etl/transformers/fields_limit_transformer.rb
Overview
A transformer that filters the fields of a record and returns a new hash with only the specified fields.
Instance Attribute Summary
Attributes inherited from Transformer
Attributes included from Registry::SelfRegistering
Instance Method Summary collapse
Methods inherited from Transformer
#call, #call_finish, #finish, #initialize
Methods included from Registry::SelfRegistering
Methods included from Configurable
Constructor Details
This class inherits a constructor from Chronicle::ETL::Transformer
Instance Method Details
#transform(record) ⇒ Object
16 17 18 19 20 |
# File 'lib/chronicle/etl/transformers/fields_limit_transformer.rb', line 16 def transform(record) # flattern hash and then take the first limit fields Chronicle::Utils::HashUtils.flatten_hash(record.data.to_h).first(@config.limit).to_h end |