Method: JsDuck::Merger#group_class_docs

Defined in:
lib/jsduck/merger.rb

#group_class_docs(docs) ⇒ Object

Gathers all tags until first @cfg or @constructor into the first bare :class group. We have a special case for @xtype which in ExtJS comments often appears after @constructor - so we explicitly place it into :class group.

Then gathers each @cfg and tags following it into :cfg group, so that it becomes array of arrays of tags. This is to allow some configs to be marked with @private or whatever else.

Finally gathers tags after @constructor into its group.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/jsduck/merger.rb', line 102

def group_class_docs(docs)
  groups = {:class => [], :cfg => [], :constructor => []}
  group_name = :class
  docs.each do |tag|
    if tag[:tagname] == :cfg || tag[:tagname] == :constructor
      group_name = tag[:tagname]
      if tag[:tagname] == :cfg
        groups[:cfg] << []
      end
    end

    if tag[:tagname] == :alias
      groups[:class] << tag
    elsif group_name == :cfg
      groups[:cfg].last << tag
    else
      groups[group_name] << tag
    end
  end
  groups
end