def post_attr_hash(post_attr)
      # Build a hash map based on the specified post attribute ( post attr =>
      # array of posts ) then sort each array in reverse order.
      @post_attr_hash[post_attr] ||= begin
        hash = Hash.new { |h, key| h[key] = [] }
        posts.docs.each do |p|
          p.data[post_attr]&.each { |t| hash[t] << p }
        end
        hash.each_value { |posts| posts.sort!.reverse! }
        hash
      end
    end
def post_attr_hash(post_attr)
      # Build a hash map based on the specified post attribute ( post attr =>
      # array of posts ) then sort each array in reverse order.
      @post_attr_hash[post_attr] ||= begin
        hash = Hash.new { |h, key| h[key] = [] }
        posts.docs.each do |p|
          p.data[post_attr]&.each { |t| hash[t] << p }
        end
        hash.each_value { |posts| posts.sort!.reverse! }
        hash
      end
    end
Construct a Hash of Posts indexed by the specified Post attribute.

 post_attr - The String name of the Post attribute.

 Examples

   post_attr_hash('categories')
   # => { 'tech' => [<Post A>, <Post B>],
   #      'ruby' => [<Post B>] }

 Returns the Hash: { attr => posts } where
   attr  - One of the values for the requested attribute.
   posts - The Array of Posts with the given attr value.