module JsonbAccessor::Macro
def group_attributes(value_fields, typed_fields)
def group_attributes(value_fields, typed_fields) value_fields_hash = process_value_fields(value_fields) typed_fields.each_with_object(nested: {}, typed: value_fields_hash) do |(attribute_name, type_or_nested), grouped_attributes| group = type_or_nested.is_a?(Hash) ? grouped_attributes[:nested] : grouped_attributes[:typed] group[attribute_name] = type_or_nested end end