def assign_groups(order)
      group_number = 0
      last_was_empty = false

      order.each_with_object({}) do |property, group|
        # A gap indicates the start of the next group
        if property.nil? || property.strip.empty?
          group_number += 1 unless last_was_empty # Treat multiple gaps as single gap
          last_was_empty = true
          next
        end

        last_was_empty = false

        group[property] = group_number
      end
    end
def assign_groups(order)
      group_number = 0
      last_was_empty = false

      order.each_with_object({}) do |property, group|
        # A gap indicates the start of the next group
        if property.nil? || property.strip.empty?
          group_number += 1 unless last_was_empty # Treat multiple gaps as single gap
          last_was_empty = true
          next
        end

        last_was_empty = false

        group[property] = group_number
      end
    end
When enforcing whether a blank line should separate "groups" of
 properties, we need to assign those properties to group numbers so we can
 quickly tell traversing from one property to the other that a blank line
 is required (since the group number would change).