class ViewComponent::Template::InlineCall

def compile_to_component

def compile_to_component
  @component.define_method(safe_method_name, @component.instance_method(@call_method_name))
end

def defined_on_self?

def defined_on_self?
  @defined_on_self
end

def initialize(component:, method_name:, defined_on_self:)

def initialize(component:, method_name:, defined_on_self:)
  variant = method_name.to_s.include?("call_") ? method_name.to_s.sub("call_", "").to_sym : nil
  details = ActionView::TemplateDetails.new(nil, nil, nil, variant)
  super(component: component, details: details)
  @call_method_name = method_name
  @defined_on_self = defined_on_self
end

def safe_method_name_call

def safe_method_name_call
  m = safe_method_name
  proc do
    maybe_escape_html(send(m)) do
      Kernel.warn("WARNING: The #{self.class} component rendered HTML-unsafe output. " \
                    "The output will be automatically escaped, but you may want to investigate.")
    end
  end
end

def type

def type
  :inline_call
end