class ViewComponent::Slot

def to_s

the slot and return it.
If there is no slot renderable, we evaluate the block passed to

set as `@__vc_content` and is returned directly.
If the slot renderable is a function and returns a string, it's

component instance, returning the string.
component, or a function that returns a component, we render that
If the slot renderable is a component, the string class name of a

There's currently 3 different values that may be set, that we can render.

Used to render the slot content in the template
def to_s
  return @content if defined?(@content)
  view_context = @parent.send(:view_context)
  if defined?(@__vc_content_block) && defined?(@__vc_content_set_by_with_content)
    raise DuplicateSlotContentError.new(self.class.name)
  end
  @content =
    if __vc_component_instance?
      @__vc_component_instance.__vc_original_view_context = @parent.__vc_original_view_context
      if defined?(@__vc_content_block)
        # render_in is faster than `parent.render`
        @__vc_component_instance.render_in(view_context) do |*args|
          @__vc_content_block.call(*args)
        end
      else
        @__vc_component_instance.render_in(view_context)
      end
    elsif defined?(@__vc_content)
      @__vc_content
    elsif defined?(@__vc_content_block)
      view_context.capture(&@__vc_content_block)
    elsif defined?(@__vc_content_set_by_with_content)
      @__vc_content_set_by_with_content
    end
  @content = @content.to_s
end