Class: JsDuck::Merger

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

Overview

Takes data from comment and code that follows it and combines these two pieces of information into one. The code comes from JsDuck::Ast and comment from JsDuck::DocAst.

The main method merge() produces a hash as a result.

Instance Method Summary collapse

Instance Method Details

#merge(docset) ⇒ Object

Takes a docset and merges the :comment and :code inside it, producing hash as a result.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/jsduck/merger.rb', line 14

def merge(docset)
  docs = docset[:comment]
  code = docset[:code]

  case docset[:tagname]
  when :class
    result = merge_class(docs, code)
  when :method, :event, :css_mixin
    result = merge_like_method(docs, code)
  when :cfg, :property, :css_var
    result = merge_like_property(docs, code)
  end

  result[:linenr] = docset[:linenr]

  result
end