Method: YARD::Templates::Helpers::BaseHelper#link_object

Defined in:
lib/yard/templates/helpers/base_helper.rb

Links to an object with an optional title

Parameters:

  • obj (CodeObjects::Base)

    the object to link to

  • title (String) (defaults to: nil)

    the title to use for the link

Returns:

  • (String)

    the linked object



122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/yard/templates/helpers/base_helper.rb', line 122

def link_object(obj, title = nil)
  return title if title

  case obj
  when YARD::CodeObjects::Base, YARD::CodeObjects::Proxy
    obj.title
  when String, Symbol
    P(obj).title
  else
    obj
  end
end