Class: JsDuck::Process::Versions

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

Overview

Generates @since and @new tags by importing JSDuck exports of older versions of the same project and looking in which version a class or method first appeared.

Additionally here the tooltip text for @new tag gets injected.

Instance Method Summary collapse

Constructor Details

#initialize(relations, opts = {}, importer = nil) ⇒ Versions

Returns a new instance of Versions.



13
14
15
16
17
18
# File 'lib/jsduck/process/versions.rb', line 13

def initialize(relations, opts={}, importer=nil)
  @relations = relations
  @opts = opts
  # Allow different importer to be injected for testing
  @importer = importer || Process::Importer.new
end

Instance Method Details

#process_all!Object

Loads in exported docs and generates @since and @new tags.



21
22
23
24
25
26
27
# File 'lib/jsduck/process/versions.rb', line 21

def process_all!
  init_new_tag_tooltip!

  if @opts[:imports].length > 0
    generate_since_tags(@importer.import(@opts[:imports]))
  end
end