Class: JsDuck::ApiExporter

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

Overview

Exporter for simple JSON format listing only class name and names of all of its members.

It produces the following structure:

{

:name => "Panel",
:members => {
  :cfg => ["width", "height", "title"],
  :method => ["getWidth", "setWidth"],
  ...
},
:statics => { ... }

}

Instance Method Summary collapse

Constructor Details

#initialize(relations, opts) ⇒ ApiExporter

Returns a new instance of ApiExporter.



22
23
24
25
# File 'lib/jsduck/api_exporter.rb', line 22

def initialize(relations, opts)
  # All params ignored, they're present to be compatible with
  # other exporters.
end

Instance Method Details

#export(cls) ⇒ Object

Returns hash of class name and member names



28
29
30
31
32
33
34
# File 'lib/jsduck/api_exporter.rb', line 28

def export(cls)
  {
    :name => cls[:name],
    :members => export_members(cls, :members),
    :statics => export_members(cls, :statics),
  }
end