module JsonbAccessor::ClassBuilder

def group_attributes(attributes)

def group_attributes(attributes)
  attributes.each_with_object(nested: {}, typed: {}) do |(name, type_or_nested), grouped_attributes|
    group = type_or_nested.is_a?(Hash) ? grouped_attributes[:nested] : grouped_attributes[:typed]
    group[name] = type_or_nested
  end
end