class YARD::Handlers::Ruby::PrivateConstantHandler

Sets visibility of a constant (class, module, const)

Private Instance Methods

privatize_constant(node) click to toggle source
# File lib/yard/handlers/ruby/private_constant_handler.rb, line 24
def privatize_constant(node)
  if node.literal? || (node.type == :var_ref && node[0].type == :const)
    node = node.jump(:tstring_content, :const)
    const = Proxy.new(namespace, node[0])
    ensure_loaded!(const)
    const.visibility = :private
  else
    raise UndocumentableError, "invalid argument to private_constant: #{node.source}"
  end
rescue NamespaceMissingError
  raise UndocumentableError, "private visibility set on unrecognized constant: #{node[0]}"
end