def hex_ranges(h3_set, k, grouped: true)
      h3_range_indexes = hex_ranges_ungrouped(h3_set, k)
      return h3_range_indexes unless grouped
      h3_range_indexes.each_slice(max_kring_size(k)).each_with_object({}) do |indexes, out|
        h3_index = indexes.first

        out[h3_index] = k_rings_for_hex_range(indexes, k)
      end
    end
def hex_ranges(h3_set, k, grouped: true)
      h3_range_indexes = hex_ranges_ungrouped(h3_set, k)
      return h3_range_indexes unless grouped
      h3_range_indexes.each_slice(max_kring_size(k)).each_with_object({}) do |indexes, out|
        h3_index = indexes.first

        out[h3_index] = k_rings_for_hex_range(indexes, k)
      end
    end
Derives H3 indexes within k distance for each H3 index in the set.

 @param [Array<Integer>] h3_set Set of H3 indexes
 @param [Integer] k K distance.
 @param [Boolean] grouped Whether to group the output. Default true.

 @example Derive the hex ranges for a given H3 set with k of 0.
   H3.hex_ranges([617700169983721471, 617700169982672895], 1)
   {
     617700169983721471 => [
       [617700169983721471],
       [
         617700170047946751, 617700169984245759, 617700169982672895,
         617700169983983615, 617700170044276735, 617700170044014591
       ]
     ],
     617700169982672895 = > [
       [617700169982672895],
       [
         617700169984245759, 617700169983197183, 617700169983459327,
         617700169982935039, 617700169983983615, 617700169983721471
       ]
     ]
   }

 @example Derive the hex ranges for a given H3 set with k of 0 ungrouped.
   H3.hex_ranges([617700169983721471, 617700169982672895], 1, grouped: false)
   [
     617700169983721471, 617700170047946751, 617700169984245759,
     617700169982672895, 617700169983983615, 617700170044276735,
     617700170044014591, 617700169982672895, 617700169984245759,
     617700169983197183, 617700169983459327, 617700169982935039,
     617700169983983615, 617700169983721471
   ]

 @raise [ArgumentError] Raised if any of the ranges contains a pentagon.

 @see #hex_range

 @return [Hash] Hash of H3 index keys, with array values grouped by k-ring.