Class: JsDuck::Exporter::Full

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

Overview

Exporter for all the class docs.

Direct Known Subclasses

App

Instance Method Summary collapse

Constructor Details

#initialize(relations, opts = {}) ⇒ Full

Returns a new instance of Full.



8
9
10
11
# File 'lib/jsduck/exporter/full.rb', line 8

def initialize(relations, opts={})
  @relations = relations
  # opts parameter is here just for compatibility with other exporters
end

Instance Method Details

#export(cls) ⇒ Object

Returns all data in Class object as hash.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/jsduck/exporter/full.rb', line 14

def export(cls)
  # Make copy of the internal data structure of a class
  # so our modifications on it will be safe.
  h = cls.internal_doc.clone

  h[:members] = {}
  h[:statics] = {}
  Class.each_member_type do |tagname|
    h[:members][tagname] = export_members(cls, {:tagname => tagname, :static => false})
    h[:statics][tagname] = export_members(cls, {:tagname => tagname, :static => true})
  end
  h[:component] = cls.inherits_from?("Ext.Component")
  h[:superclasses] = cls.superclasses.collect {|c| c[:name] }
  h[:subclasses] = @relations.subclasses(cls).collect {|c| c[:name] }.sort
  h[:mixedInto] = @relations.mixed_into(cls).collect {|c| c[:name] }.sort
  h[:alternateClassNames] = cls[:alternateClassNames].sort if cls[:alternateClassNames]

  h[:mixins] = cls.deps(:mixins).collect {|c| c[:name] }.sort
  h[:parentMixins] = cls.parent_deps(:mixins).collect {|c| c[:name] }.sort
  h[:requires] = cls.deps(:requires).collect {|c| c[:name] }.sort
  h[:uses] = cls.deps(:uses).collect {|c| c[:name] }.sort

  h
end