class ViewComponent::DocsBuilderComponent::MethodDoc

def call

def call
  <<~DOCS.chomp
    `#{separator}#{signature_or_name}`#{types}#{suffix}
    #{docstring_and_deprecation_text}
  DOCS
end

def deprecated?

def deprecated?
  @method.tag(:deprecated).present?
end

def deprecation_text

def deprecation_text
  @method.tag(:deprecated)&.text
end

def docstring

def docstring
  @method.docstring
end

def docstring_and_deprecation_text

def docstring_and_deprecation_text
  <<~DOCS.strip
    #{docstring}
    #{"_#{deprecation_text}_" if deprecated?}
  DOCS
end

def initialize(method, show_types = true)

def initialize(method, show_types = true)
  @method = method
  @show_types = show_types
end

def separator

def separator
  @method.sep
end

def signature_or_name

def signature_or_name
  @method.signature ? @method.signature.gsub("def ", "") : @method.name
end

def suffix

def suffix
  " (Deprecated)" if deprecated?
end

def types

def types
  " → [#{@method.tag(:return).types.join(",")}]" if @method.tag(:return)&.types && @show_types
end