class ViewComponent::SlotV2
def to_s
If there is no slot renderable, we evaluate the block passed to
set as `@_content` and is returned directly.
If the slot renderable is a function and returns a string, it is
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 view_context = @parent.send(:view_context) view_context.capture do if defined?(@_component_instance) # render_in is faster than `parent.render` @_component_instance.render_in(view_context, &@_content_block) elsif defined?(@_content) @_content elsif defined?(@_content_block) @_content_block.call end end end