Method: YARD::CodeObjects::Base#docstring

Defined in:
lib/yard/code_objects/base.rb

#docstring(locale = I18n::Locale.default) ⇒ Docstring

The documentation string associated with the object

Parameters:

  • locale (String, I18n::Locale) (defaults to: I18n::Locale.default)

    (I18n::Locale.default) the locale of the documentation string.

Returns:



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/yard/code_objects/base.rb', line 405

def docstring(locale = I18n::Locale.default)
  if locale.nil?
    @docstring.resolve_reference
    return @docstring
  end

  if locale.is_a?(String)
    locale_name = locale
    locale = nil
  else
    locale_name = locale.name
  end
  @docstrings[locale_name] ||=
    translate_docstring(locale || Registry.locale(locale_name))
end