Class: Jazzy::SourceModule

Inherits:
Object
  • Object
show all
Includes:
Config::Mixin
Defined in:
lib/jazzy/source_module.rb

Overview

A cache of info that is common across all page templating, gathered from other parts of the program.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Config::Mixin

#config

Constructor Details

#initialize(docs, doc_structure, doc_coverage, docset_builder) ⇒ SourceModule

Returns a new instance of SourceModule.



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jazzy/source_module.rb', line 24

def initialize(docs, doc_structure, doc_coverage, docset_builder)
  self.docs = docs
  self.doc_structure = doc_structure
  self.doc_coverage = doc_coverage
  title = config.readme_title || config.module_names.first
  self.readme_title = title.empty? ? 'Index' : title
  self.author_name = config.author_name
  self.author_url = config.author_url
  self.host = SourceHost.create(config)
  self.dash_feed_url = docset_builder.dash_feed_url
end

Instance Attribute Details

#author_nameObject

Returns the value of attribute author_name.



19
20
21
# File 'lib/jazzy/source_module.rb', line 19

def author_name
  @author_name
end

#author_urlObject

Returns the value of attribute author_url.



20
21
22
# File 'lib/jazzy/source_module.rb', line 20

def author_url
  @author_url
end

#dash_feed_urlObject

Returns the value of attribute dash_feed_url.



21
22
23
# File 'lib/jazzy/source_module.rb', line 21

def dash_feed_url
  @dash_feed_url
end

#doc_coverageObject

Returns the value of attribute doc_coverage.



17
18
19
# File 'lib/jazzy/source_module.rb', line 17

def doc_coverage
  @doc_coverage
end

#doc_structureObject

Returns the value of attribute doc_structure.



18
19
20
# File 'lib/jazzy/source_module.rb', line 18

def doc_structure
  @doc_structure
end

#docsObject

Returns the value of attribute docs.



16
17
18
# File 'lib/jazzy/source_module.rb', line 16

def docs
  @docs
end

#hostObject

Returns the value of attribute host.



22
23
24
# File 'lib/jazzy/source_module.rb', line 22

def host
  @host
end

#readme_titleObject

Returns the value of attribute readme_title.



15
16
17
# File 'lib/jazzy/source_module.rb', line 15

def readme_title
  @readme_title
end

Instance Method Details

#all_declarationsObject



36
37
38
39
40
41
42
43
44
# File 'lib/jazzy/source_module.rb', line 36

def all_declarations
  all_declarations = []
  visitor = lambda do |d|
    all_declarations.unshift(*d)
    d.map(&:children).each { |c| visitor[c] }
  end
  visitor[docs]
  all_declarations.reject { |doc| doc.name == 'index' }
end