Method: YARD::Templates::Helpers::BaseHelper#format_object_type

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

#format_object_type(object) ⇒ String

Returns the human-readable formatted #type for the object.

Examples:

Formatted type of an exception class

o = ClassObject.new(:root, :MyError)
o.superclass = P('RuntimeError')
format_object_type(o) # => "Exception"

Formatted type of a method

o = MethodObject.new(:root, :to_s)
format_object_type(o) # => "Method"

Parameters:

Returns:

  • (String)

    the human-readable formatted #type for the object



182
183
184
185
186
187
188
189
# File 'lib/yard/templates/helpers/base_helper.rb', line 182

def format_object_type(object)
  case object
  when YARD::CodeObjects::ClassObject
    object.is_exception? ? "Exception" : "Class"
  else
    object.type.to_s.capitalize
  end
end