You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: components_helper.rb
    path of file: ./repos/danbooru/app/helpers
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module ComponentsHelper
  def post_preview(post, fit: :fixed, **options, &block)
    render PostPreviewComponent.new(post: post, fit: fit, **options), &block
  end
    
  def render_post_gallery(posts, **options, &block)
    posts = posts.includes(:media_asset) if posts.is_a?(ActiveRecord::Relation)

    render(PostGalleryComponent.new(**options)) do |gallery|
      posts.each do |post|
        gallery.with_post(post: post, size: gallery.size, **options)
      end

      if block_given?
        yield(gallery, posts)
      end
    end