Class: JsDuck::Format::Class

Inherits:
Object
  • Object
show all
Defined in:
lib/jsduck/format/class.rb

Overview

Performs documentation formatting of a class and all of its members.

The actual work is delegated to the #format methods of Tag classes, to which we pass the Format::Doc instance which they can use to perform the formatting.

The formatting done by #format methods usually consists of turning :doc properties of class from markdown to HTML, resolving @links, and converting type definitions to HTML.

Instance Method Summary collapse

Constructor Details

#initialize(formatter) ⇒ Class

Returns a new instance of Class.



17
18
19
# File 'lib/jsduck/format/class.rb', line 17

def initialize(formatter)
  @formatter = formatter
end

Instance Method Details

#format(cls) ⇒ Object

Runs the formatter on doc object of a class. Accessed using Class#internal_doc



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/jsduck/format/class.rb', line 23

def format(cls)
  @formatter.class_context = cls[:name]
  @formatter.doc_context = cls[:files][0]

  format_tags(cls)

  # format all members (except hidden ones)
  cls[:members].each {|m| format_member(m) unless m[:hide] }

  cls
end

#imagesObject

Access to the Img::DirSet object inside doc-formatter



36
37
38
# File 'lib/jsduck/format/class.rb', line 36

def images
  @formatter.images
end