Class: JsDuck::News

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relations, doc_formatter) ⇒ News

Generates list of new classes & members in this version.



18
19
20
21
22
# File 'lib/jsduck/news.rb', line 18

def initialize(relations, doc_formatter)
  @doc_formatter = doc_formatter
  @columns = Columns.new(:members)
  @new_items = filter_new_items(relations)
end

Class Method Details

.create(relations, doc_formatter, opts) ⇒ Object

Creates News object from relations data when –import option specified.



9
10
11
12
13
14
15
# File 'lib/jsduck/news.rb', line 9

def self.create(relations, doc_formatter, opts)
  if opts[:imports].length > 0
    News.new(relations, doc_formatter)
  else
    Util::NullObject.new(:to_html => "")
  end
end

Instance Method Details

#to_html(style = "") ⇒ Object

Returns the HTML



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/jsduck/news.rb', line 25

def to_html(style="")
  return [
    "<div id='news-content' style='#{style}'>",
      "<div class='section'>",
        "<h1>New in this version</h1>",
          render_news(@new_items),
        "<div style='clear:both'></div>",
      "</div>",
    "</div>",
  ].flatten.join("\n")
end