Class: Julewire::Core::Processing::RecordFieldTransform
- Inherits:
-
Object
- Object
- Julewire::Core::Processing::RecordFieldTransform
- Defined in:
- lib/julewire/core/processing/record_field_transform.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(record) ⇒ Object
-
#initialize(max_array_items: nil, max_depth: nil, max_hash_keys: nil, max_string_bytes: nil, preserve_top_level_keys: nil, track_paths: false) ⇒ RecordFieldTransform
constructor
A new instance of RecordFieldTransform.
Constructor Details
#initialize(max_array_items: nil, max_depth: nil, max_hash_keys: nil, max_string_bytes: nil, preserve_top_level_keys: nil, track_paths: false) ⇒ RecordFieldTransform
Returns a new instance of RecordFieldTransform.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/julewire/core/processing/record_field_transform.rb', line 22 def initialize( max_array_items: nil, max_depth: nil, max_hash_keys: nil, max_string_bytes: nil, preserve_top_level_keys: nil, track_paths: false ) @bounded_options = ( max_array_items: max_array_items, max_depth: max_depth, max_hash_keys: max_hash_keys, max_string_bytes: max_string_bytes ) @preserve_top_level_key_set = Array(preserve_top_level_keys).to_h { [it, true] } @track_paths = track_paths end |
Class Method Details
.container_key?(key) ⇒ Boolean
17 |
# File 'lib/julewire/core/processing/record_field_transform.rb', line 17 def container_key?(key) = CONTAINER_KEY_SET.key?(key) |
.scalar_key?(key) ⇒ Boolean
19 |
# File 'lib/julewire/core/processing/record_field_transform.rb', line 19 def scalar_key?(key) = SCALAR_KEY_SET.key?(key) |
Instance Method Details
#call(record) ⇒ Object
40 41 42 43 44 |
# File 'lib/julewire/core/processing/record_field_transform.rb', line 40 def call(record, &) record.each_with_object({}) do |(key, value), result| result[key] = transform_record_field(key, value, record, &) end end |