Class: JsDuck::Merger
- Inherits:
-
Object
- Object
- JsDuck::Merger
- 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::JS::Ast and comment from JsDuck::Doc::Processor.
The main method merge() produces a hash as a result.
Instance Method Summary collapse
-
#merge(docset, filename = "", linenr = 0) ⇒ Object
Takes a docset and merges the :comment and :code inside it, producing hash as a result.
Instance Method Details
#merge(docset, filename = "", linenr = 0) ⇒ Object
Takes a docset and merges the :comment and :code inside it, producing hash as a result.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/jsduck/merger.rb', line 15 def merge(docset, filename="", linenr=0) docs = docset[:comment] code = process_code(docset[:tagname], docset[:code]) h = { :tagname => docset[:tagname], :name => docs[:name] || code[:name] || "", :autodetected => code[:autodetected] || {}, :files => [{:filename => filename, :linenr => linenr}], } general_merge(h, docs, code) invoke_merge_in_member_tag(h, docs, code) # Needs to be calculated last, as it relies on the existance of # :name, :static and :tagname fields. h[:id] = JsDuck::Class.member_id(h) h end |